首页 > 解决方案 > 如何使用 pandoc/latex 在 markdownfile 中调整所有图像的大小和位置?

问题描述

我正在寻找一种方法来调整现有降价文件中所有图像的大小,例如,我希望所有图片的最大宽度为文本块宽度的 80%,并且所有图像都居中并加边框。我该怎么做?有没有办法自定义边框,例如该边框的颜色和宽度?

这是我的降价文件的示例:

# 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. |

使用 pandoc 和这个 shell 脚本:

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"

和这个 tex 文件

\usepackage{sectsty}
\sectionfont{\clearpage}

我得到这个结果

第 1 页

第2页

我正在寻找一种使用 pandoc shellscript 将所有图片宽度缩小到 80% 文本宽度的方法。

此外,我正在寻找一种解决方案,以正确的方式格式化表格,因为它的宽度不正确。但仍在使用

\usepackage{sectsty}
\sectionfont{\clearpage}

tex 文件。非常感谢您的帮助!

标签: imagelatexmarkdownpandocpdflatex

解决方案


您可以使用图像更改默认值,\setkeys{Gin}{width=.8\linewidth}并且可以使用floatrow包添加边界:

\usepackage{sectsty}
\sectionfont{\clearpage}

\usepackage{floatrow}
\floatsetup[figure]{style=boxed} 

\setkeys{Gin}{width=.8\linewidth}

在此处输入图像描述

(请每个问题只问一个问题。您可以针对与表格无关的问题提出一个新问题)


推荐阅读