这是我在页脚中尝试实现的一个最小工作示例。
我试图让页脚规则与顶部大致一致example-image-a
。lfoot
文本(由 4 行组成)应大致占据与rfoot
文本(由 3 行组成,字体大小略大)相同的垂直高度。
我目前的问题是rfoot
上面有一个很大的间隙,所以它与 完全不对齐lfoot
。
代码
\documentclass[11pt]{article}
\usepackage[left=1.5cm,top=2.5cm,right=3.5cm,bottom=3.2cm,footskip=1.1cm,a4paper]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\setstretch{1.3}
\usepackage{blindtext}
\usepackage{tikz,tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{14pt}
\setlength{\topmargin}{-1.5cm}
\renewcommand{\footrulewidth}{0.5pt}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\lfoot{\parbox{0.7\textwidth}{\footnotesize TITLE GOES HERE \\ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}
}
\rfoot{\small \setstretch{1.3} Some text goes here \\ Some more text goes here \\ and more here
\begin{tikzpicture}[remember picture,overlay]
\node [inner sep=0cm,outer sep=0,yshift=1.75cm,xshift=8.75cm] (picture)
at (current page.south){\includegraphics[height=1.5cm,width=1.5cm]{example-image-a}};
\end{tikzpicture}
}
\begin{document}
\Blindtext
\end{document}
更新
为了完全清楚,这是我想要实现的布局。
大致
rfoot
保持在同一位置。但规则和
lfoot
举措却有所松懈。
答案1
既然您已经加载并使用tikz
和tikzpagenodes
,那么您不能简单地使用这些包来放置对象吗?
\documentclass[11pt]{article}
\usepackage[left=1.5cm,top=2.5cm,right=3.5cm,bottom=3.2cm,footskip=1.1cm,a4paper]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\setstretch{1.3}
\usepackage{blindtext}
\usepackage{tikz,tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{14pt}
\setlength{\topmargin}{-1.5cm}
%\renewcommand{\footrulewidth}{0.5pt}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\lfoot{\begin{tikzpicture}[remember picture,overlay,nodes={outer sep=0pt,inner
sep=0pt}]
\node[anchor=north west,font=\footnotesize,align=left,text width=0.7\textwidth] at
([yshift=-6ex]current page text area.south west) {TITLE GOES HERE \\ Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.};
\node[anchor=north east,font=\small\setstretch{1.3},align=right,
text width=0.25\textwidth] at
([yshift=-6ex]current page text area.south east){Some text goes here \\ Some more text goes here \\ and more here };
\node [anchor=north west] (picture) at
([yshift=-6ex,xshift=1em]current page text area.south east){\includegraphics[height=1.5cm,width=1.5cm]{example-image-a}};
\draw ([yshift=-4.8ex]current page text area.south west) -- ([yshift=-4.8ex]current page text
area.south east);
\end{tikzpicture}
}
\rfoot{}
\begin{document}
\Blindtext
\end{document}
答案2
以下是另一个不带的建议tikzpagenodes
:
\documentclass[11pt,a4paper]{article}
\usepackage[left=1.5cm,right=3.5cm,bottom=3.2cm,footskip=1.1cm]{geometry}
\usepackage{setspace}
\setstretch{1.3}
\usepackage{blindtext}
\usepackage{tikz}% loads graphicx, xcolor, ...
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{14pt}
\setlength{\topmargin}{-1.5cm}
\renewcommand{\footrulewidth}{0.5pt}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\lfoot{%
\parbox[t]{0.7\textwidth}
{\footnotesize
TITLE GOES HERE \\
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
}}
\rfoot{%
\parbox[t]{0.25\textwidth}
{\raggedleft\small\setstretch{1.3}%
Some text goes here \\ Some more text goes here \\ and more here}%
\rlap{\hspace{1cm}%
\smash{\raisebox{\dimexpr-\height+\ht\strutbox\relax}{%
\begin{tikzpicture}
\node [inner sep=0cm,outer sep=0]
{\includegraphics[height=1.5cm,width=1.5cm]{example-image-a}};
\end{tikzpicture}%
}}}}
\begin{document}
\Blindtext
\end{document}
结果: