Posts

Showing posts with the label Spacing

Aligning Pseudocode In LaTeX

Image
Answer : I have never used an algorithm package in Latex, what I'd do is use the verbatim environment and manually indent the code in the text editor. \begin{verbatim} 1 y=0 2 for i = n downto 0 3 y = a_i + x * y \end{verbatim} This will put exactly what you type in the environment in the output, including whitespace. If you need fancy Latex (like subscript and such) check the alltt package. Info on Verbatim If I were you and I was absolutely sure that the algorithmic package is not the way to go, I'd use something like this: \begin{align*} &y = 0 \\ &\text{for $i = n$ downto 0} \\ & \hspace{1cm} y = a_i + x * y \end{align*} This results in Edit 2: Sorry, from your code excerpt and another answer, I somehow thought you wanted verbatim text. I have had success using algorithmicx . It is customizable for your needs. Documentation (PDF) \usepackage{algorithm} \usepackage[noend]{algpseudocode} \begin{algorithm} \begin{algorithmic} \Stat...

Add Space Between Paragraphs In Beamer

Answer : I had the same problem: blank lines in latex articles produces a clearly separated paragraph, but in Beamer, with the limited space and no indentation, the default new paragraph is does not strikingly separate the paragraphs. My hack solution was to append the following latex code to the end of the paragraph that should have the space. \\~\ For example, try inserting this into a Beamer latex file: \frame{ This is text that should have a blank line after it. \\~\\ Here is text following a blank line. } I've noticed this too when preparing slides. Rather than have two paragraphs and separate them with vertical space explicitly, I've often used one of the following workarounds: convert each of the paragraphs you want to split to a block-like environment such as theorem , question , answer , etc. That way (in my theme, at least) they get boxed and visually separated. if the two paragraphs are supporting material to the same point, use an itemize env...