Search code examples
imagelatexmarkdownpandocpdflatex

How to size and position all images in a markdownfile with pandoc/latex?


i am looking for a way to resize all images in an existing markdown file e.g. i want all pictures to have a max width of 80% of the textblock width and have all the images centered and bordered. How do I do this and is there a way to customize borders, e.g. colors and width of that border?

This is an example of my markdown file:

# section
## subsection
### subsubsection



![dummy1](.\dummy1.jpg)

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting.

![dummy2](.\dummy2.png)



| Eigenschaft |             Typ             | Beschreibung                                                 |
| :---------: | :-------------------------: | :----------------------------------------------------------- |
|  `general`  | `object` <br/> *(optional)* | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. |
|   `esri`    | `object` <br/> *(optional)* | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. |
|  `webgen`   | `object` <br/> *(optional)* | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. |

using pandoc and this shell script:

pandoc "$1" \
    -f gfm \
    --include-in-header chapter_break.tex \
    --highlight-style pygments\
    -V linkcolor:blue \
    -V geometry:a4paper \
    -V geometry:margin=2cm \
    -V mainfont="Arial" \
    -V monofont="Arial" \
    -o "$2"

and this tex file

\usepackage{sectsty}
\sectionfont{\clearpage}

i get this result

page 1

page 2

I am looking for a way using pandoc shellscript to get all pictures width scaled down to 80% text width.

Also I am looking for a solution to get the tabled formatted in the right way as its width is not right. But still using the

\usepackage{sectsty}
\sectionfont{\clearpage}

tex file. Thank you alot for your help!


Solution

  • You can change the default with of the images using \setkeys{Gin}{width=.8\linewidth} and boarders can be added with the floatrow package:

    \usepackage{sectsty}
    \sectionfont{\clearpage}
    
    \usepackage{floatrow}
    \floatsetup[figure]{style=boxed} 
    
    \setkeys{Gin}{width=.8\linewidth}
    

    enter image description here

    (please only ask one question per question. You can ask a new question for the unrelated problem about the table)