我需要一行中的两个框,每个框左侧包含一个文本,右侧包含一个二维码。
因此,我开始:
\documentclass[a4paper]{article}
\usepackage{xcolor}
\usepackage{qrcode}
\begin{document}
\fcolorbox{black}{white}{%
\begin{minipage}[t]{3cm}
\noindent
Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text
\end{minipage}
\hspace{1cm}
\begin{minipage}[t]{2cm}
\qrcode{https://www.wetteronline.de/wetter/duisburg}
\end{minipage}
}
\hfill
\fcolorbox{black}{white}{%
\begin{minipage}[t]{3cm}
\noindent
Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text Some dummy text
\end{minipage}
\hspace{1cm}
\begin{minipage}[t]{2cm}
\qrcode{https://www.wetteronline.de/wetter/duisburg}
\end{minipage}
}
\end{document}
但这给我带来了两个问题:
每个框内的文本顶部都留有大量空间。我希望框内填满文本和二维码,顶部不留任何额外空间。
两个框都不在同一行,而是位于页面的中间,一个位于顶部,一个位于下方。
有人可以提示如何放置框并删除文本前不需要的空间吗?
我使用 pdflatex 来创建我的 pdf。
答案1
的参考点\qrcode
几乎垂直居中。您可以使用 来adjustbox
移动它。
\documentclass[a4paper]{article}
\usepackage{xcolor}
\usepackage{qrcode}
\usepackage{adjustbox}
\begin{document}
The baseline \_\qrcode{https://www.wetteronline.de/wetter/duisburg}\_
\bigskip
\fbox{%
\begin{minipage}[t]{3cm}
Some dummy text Some dummy text Some dummy text Some dummy text
Some dummy text Some dummy text Some dummy text Some dummy text
Some dummy text Some dummy text Some dummy text Some dummy text
Some dummy text Some dummy text Some dummy text
\end{minipage}\hspace{1cm}%
\adjustbox{valign=t}{\qrcode{https://www.wetteronline.de/wetter/duisburg}}%
}
\end{document}