Consider the following code (no special packages added)
\begin{document}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text
\begin{center}
\includegraphics{black_square} and \includegraphics{black_square}
\par\end{center}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text
\end{document}
that produces the output , where the black squares stand for some image I wand to put in my document.
My questions are:
-
Is this the right way to add images to a document ? I'm vaguely aware that there are some floating environments available for this, but I want the images at exactly this specific place.
-
How can I rearrange the black square so that they are horizontally evenly distributed and the "and" is vertically in the middle, i.e. more like this:
Best Answer
Since
\includegraphics
places images upon the text baseline, I here use\raisebox
to shift the figures down (1/2 of their height - 1/2 the height of a textline). Then, by placing symmetric\hspace
s around the word "and", I can achieve a symmetric layout. I use%
at the end of the lines to prevent stray spaces from getting introduced.If you wanted the figures to be exactly spaced between the margin and the middle text, this would suffice, replacing the
center
environment with the appropriate\hfil
s, making sure to not indent the "paragraph" on which the figures appear.