我想创建一个带有页脚的文章文档,就像 moderncv 中的一样,见图。有人知道我该怎么做吗?它不一定非要与 moderncv 中的完全相同,但要类似。
答案1
moderncv
创建所显示页脚的相关代码部分是:
\renewcommand*{\makeletterfooter}{%
\setlength{\footerwidth}{0.8\textwidth}%
\fancypagestyle{plain}{%
\fancyfoot[c]{%
\parbox[b]{\footerwidth}{%
\centering%
\addressfont\color{color2}%
\vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
\vspace{-\baselineskip}% to cancel out the extra vertical space taken by the name (below) and ensure perfect alignment of letter and cv footers
\strut{\bfseries\upshape\@firstname~\@lastname}\\% the \strut is required to ensure the line is exactly \baselineskip tall
\ifthenelse{\isundefined{\@addressstreet}}{}{\addtofooter[]{\addresssymbol\@addressstreet}%
\ifthenelse{\equal{\@addresscity}{}}{}{\addtofooter[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtofooter[~--~]{\@addresscountry}}%
\flushfooter\@firstfooterelementtrue\\}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtofooter{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@email}}{}{\addtofooter{\emailsymbol\emaillink{\@email}}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtofooter{\homepagesymbol\httplink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\addtofooter{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\addtofooter{\@extrainfo}}%
\ifthenelse{\lengthtest{\footerboxwidth=0pt}}{}{\flushfooter}% the lengthtest is required to avoid flushing an empty footer, which could cause a blank line due to the \\ after the address, if no other personal info is used
}}}%
\pagestyle{plain}}
如您所见,页脚是包使用的一部分fancyhdr
,定义为居中页脚\fancyfoot[c]{...}
。\parbox[b]
创建一个居中的框\centering
,其中包含姓氏,名字等所需的信息。
因此,您可以创建一个自己的简化页脚:
\fancyfoot[c]{%
\parbox[b]{0.8\textwidth}{%
\centering%
\vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
\vspace{-\baselineskip}% to cancel out the extra vertical space taken by the name (below) and ensure perfect alignment of letter and cv footers
\strut{\bfseries\upshape firstname~lastname}\\% the \strut is required to ensure the line is exactly \baselineskip tall
street number~city\\
phone~email~etc.
}%end parbox
}%end fancyfoot
将名字等更改为您的数据。
这应该可以为您提供一个起点,让您自己动手做...