![将文本和图像置于线上](https://linux22.com/image/377861/%E5%B0%86%E6%96%87%E6%9C%AC%E5%92%8C%E5%9B%BE%E5%83%8F%E7%BD%AE%E4%BA%8E%E7%BA%BF%E4%B8%8A.png)
我找到了一种方法来放置如图所示的日期和签名行,并使用以下 LaTeX 代码,但我正在努力弄清楚如何在不移动所有内容的情况下将日期和图像签名放在线上。
以下是我正在使用的代码:
\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\graphicspath{ {Images/} }
\usepackage{fancyhdr}
\newcommand*\wildcard[2][5cm]{\vspace*{2cm}\parbox{#1}{\hrulefill\par#2}}
\begin{document}
\input{Chapters/Affidavit}
\vspace{4cm}
\begingroup
\centering
\wildcard{Date}
\hspace{1cm}
\wildcard{Signature}
\par
\endgroup
\end{document}
答案1
使用两个表格似乎更简单:
\documentclass[12pt, a4paper]{report}
\usepackage{graphicx}
\begin{document}
\chapter*{Affidavit}
Herewith bla bla.
\bigskip
\noindent
\begin{tabular}[b]{@{} p{6cm} @{}}
15 June 2018\\
\hline
\scriptsize Date
\end{tabular}\qquad
\begin{tabular}[b]{@{} p{6cm} @{}}
\includegraphics[width=6cm,height=1cm]{example-image} \\
\hline
\scriptsize Signature
\end{tabular}
\end{document}
答案2
为了将文本和图像定位在线上方,您可以使用tabular
:
\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\newcommand*\wildcard[2][5cm]{\parbox{#1}{\hrulefill\par#2}}
\begin{document}
\noindent
\begin{tabular}{@{}p{0.5\textwidth}@{} @{}p{0.5\textwidth}@{}}
15.06.2018 & \includegraphics[width=3cm, height=1cm]{example-image}\\
\wildcard{Date} & \wildcard{Signature}
\end{tabular}
\end{document}