Donnerstag, 30. August 2012

Placing text and figure side-by-side in a section in LaTeX.

After struggling a long time i want to share my information with you. It was so hard to find this out but now it works. I wanted to have a picture beside text. But as you know in LaTeX it is not so easy to place a picture at a fix position. In the Picture you can see how i wanted it to be.
text from http://www.loremipsum.de
And here is the source code for this (a bit shorten but with all relevant information): I had to define a new environment which isn't floating [1]. The Environment doesn't change anything, but you can do so if you like (see Wikibooks). Right after my subsection started i placed my new environment and started a minipage inside it [2]. I use the positioning parameter t, which tells LaTeX to place the minipage and the content on top. In [3] i use vspace to define no Space to the top of the minipage. As far as i understand this has to be used because pictures will always be placed on the bottom. Then i place the picture in the second part of the minipage. I have to use captionof [4] to define a caption outside a floating environment. I tried a lot of stuff (placeins, float, \clearpage, \FloatBarrier, etc.) but in the end only this worked for me.

Keine Kommentare:

Kommentar veröffentlichen