0

My source file contains images, variously placed left and right. The text wraps around the images. When I convert it to pdf using my LaTeX template, I want the images and text wrapping to appear as they do in the source file.

I assume I insert \usepackage{wrapfig} in the preamble of my template. After that, I don't know what the related commands should be. I think I understand the commands should be something like this:

\begin{wrapfigure}{r}{.3\textwidth}
 \centering
 \includegraphics{image}
\end{wrapfigure}

However, this is a template. I don't want the images to always be on the right {r}, but appear as placed in the source file--some on left side, some on right side. Also, the images are different, so it seems that {image} in the above code is image specific, and needs to be written so it will apply to each of the different images.

Ingmar
  • 6,690
  • 5
  • 26
  • 47
william
  • 39
  • 1
    You're asking quite a few inter-related questions. Have you studied the user guide of the wrapfig package? Are there parts of the user guide you're not sure you understand? – Mico Jul 27 '23 at 04:13
  • 1
    What do you mean, "convert your file" using a LaTeX template? Your LaTeX file is your document, you simply place text and images in there as you see fit – even if you may start out with a template, aka some sample code to get you started. – Ingmar Jul 27 '23 at 04:48
  • Is your source file a LaTeX document or a document using another document format (e.g. md, html, docx, …) and the question is more or less how to configure a document format converter (e.g. pandoc, writertolatex, …) to produce suitable LaTeX code for wrapping? If it is a LaTeX document: \includegraphics always get the name of the image to be included → Packages in the ‘graphics’ bundle, Section 4.4. So your question about {image} is somehow confusing. – cabohah Jul 27 '23 at 08:20
  • You culd use a counter and go right on odd and left on even. However, if you want to do both in one paragraph, see https://tex.stackexchange.com/questions/526518/wrapfigure-two-figures-left-and-right-with-text-in-between – John Kormylo Jul 27 '23 at 11:55
  • If I am right, the commands I posted are consistent with {wrapfig}.

    I use pandoc to convert md files to pdfs using my "template.latex." I point pandoc to my images folder, and the pdf includes the images in my markdown file.

    The images in the pdf file, however, are not sized or wrapped or placed as they are in the markdown file. Thus, I should revise my question:what commands do I have to put in my latex template to cause my images rendered in the pdf to be (1) sized and (2) placed, and (3) wrapped as in my source markdown file; and (4) centered (\centering) which is a nice feature?

    – william Jul 27 '23 at 23:36

0 Answers0