Text FormattingPlace text between algorithms and adjust

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
rumi
Posts: 2
Joined: Tue Dec 27, 2016 9:00 am

Place text between algorithms and adjust

Post by rumi »

Hi,
I am having issue with adjusting my text beneath specific algorithm, how should i make it work? I am using this code:

Code: Select all

\begin{algorithm}[h]
\caption
\begin{algorithmic}
\Procedure
...
\EndProcedure
\end{algorithmic}
\end{algorithm}
My text which i need to add beneath it and then next algo..
Last edited by Stefan Kottwitz on Thu Dec 29, 2016 12:09 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Text adjustment

Post by Stefan Kottwitz »

Hi Rumi,

welcome to the forum! What exactly is the issue with the adjustment? Not left aligned? Indented? Not fully justified? Centered?

Stefan
LaTeX.org admin
rumi
Posts: 2
Joined: Tue Dec 27, 2016 9:00 am

Text adjustment

Post by rumi »

Thank u Stefan.. My problem is that I have a two column paper and I want description of each algorithm beneath it i.e rigth after the algorithm. In my case what's happening is, that description of two algorithms gets combined.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Place text between algorithms and adjust

Post by Stefan Kottwitz »

Algorithms are intended to float, so LaTeX places them for optimal page breaks and column breaks, to avoid much undesired whitespace when the algorithm doesn't fit to the end of page or column and is moved to the next one.

If you would like to place the algorithm at an exact position in the text, simply use H instead of h, that forces it:

Code: Select all

\begin{algorithm}[H]
...
\end{algorithm}
Btw. next time it would be great if you would post a compilable small example. With the code snippet above, we don't know the document class, or what packages are used, there are algorithm, algorithmic, algorithmicx, algpseudocode, and more.

Stefan
LaTeX.org admin
Post Reply