我正在尝试设置一个应用说明样式,这是我目前所得到的:
\documentclass[a4paper,twocolumn,twoside,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[]{Chivo}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pgf, tikz}
\usepackage{mathrsfs}
\usepackage{verbatim}
\usepackage{lastpage}
\usetikzlibrary{shapes, calc, shapes, arrows, babel}
\usepackage{amsmath, amssymb, textcomp}
\everymath{\displaystyle}
\usepackage{eurosym}
\usepackage{graphicx}
\graphicspath{{./img/}}
\usepackage{svg}
\usepackage{lipsum}
\usepackage{hyperref}
% custom header/footer
\usepackage{fancyhdr}
%\pagestyle{fancy}
\makeatletter
\newcommand{\logo}{\includegraphics[width=0.6\columnwidth]{logo.png}}
\newcommand{\logosmall}{\includegraphics[width=0.3\columnwidth]{logo.png}}
\newcommand{\claim}{©YYYY Company name, Inc. All rights reserved.\\ Trademarks and registered trademarks are the\\\vspace{-6pt} property of their respective owners.}
\newcommand{\website}{www.companysite.com}
\renewcommand{\date}[1]{\gdef\@date{#1}}
\newcommand*{\revision}[1]{\gdef\@revision{#1}}
\newcommand*{\code}[1]{\gdef\@code{#1}}
\newcommand*{\type}[1]{\gdef\@type{#1}}
%
%
% First page
%
\fancypagestyle{first}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
\fancyhead[L]{\logo}
\fancyhead[R]{%
\huge{\bf{%
\@code\\
\@type
}}}%
\renewcommand{\headrulewidth}{2pt}
\headrule
%
\fancyfoot[L]{\@date}
\fancyfoot[C]{\@revision}
\fancyfoot[R]{Page~\thepage~of~\pageref{LastPage}}
}
%
% Document body
\fancypagestyle{body}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
%
\fancyfoot[L]{\@date}
\fancyfoot[C]{\@revision}
\fancyfoot[R]{Page~\thepage~of~\pageref{LastPage}}
}
%
%
% Last page
\fancypagestyle{last}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
%
\fancyfoot[L]{\vspace*{-10pt}{\tiny \claim}\\ \@date}
\fancyfoot[C]{\vspace{-20pt}\logosmall\\ \@revision}
\fancyfoot[R]{\fbox{%
\parbox{0.3\textwidth}{
\large{
\vspace*{10pt}
\textbf{\website}
\vspace*{-5pt}
}}}\\
Page~\thepage~of~\pageref{LastPage}
}
}
\makeatother
% custom title
\makeatletter
\renewcommand*{\maketitle}{%
\renewcommand{\familydefault}{\sfdefault}
\thispagestyle{first}
\twocolumn[
\let\clearpage\relax% Remove \clearpage functionality
\vspace*{-10pt}% Insert needed vertical retraction
\begin{@twocolumnfalse}
\begin{center}
\bf{
{\LARGE\@title\par}
\@author
}
\end{center}
\end{@twocolumnfalse}
\vspace*{30pt}
]
}%
\makeatother
\setcounter{secnumdepth}{0} % sections are level 1
\title{My Outstanding Application Note Title}
\author{J.~Doe}
\date{22.02.2019}
\revision{Rev.~0.1}
\code{AN-1}
\type{APPLICATION~NOTE}
\begin{document}
\maketitle
\tableofcontents
\clearpage
\pagestyle{body}
\section{Section}
\lipsum[1]
\section{Section}
\lipsum[2]
\subsection{Subsection}
\lipsum[3]
\section{Section}
\lipsum[4]
\subsection{Subsection}
\lipsum[5]
\paragraph{Paragraph}
\lipsum[6]
\subsection{Subsection}
\lipsum[7]
\paragraph{Paragraph}
\lipsum[8]
\newpage
\clearpage
\pagestyle{last}
\begin{onecolumn}
\begin{table}[!ht]%
\caption{Revision history.}
\label{}
\centering
\begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
\hline
Revision & Author & Changes\\
\hline
cell 1 & cell 2 & cell 3\\
cell 1 & cell 2 & cell 3\\
\hline
\end{tabular}
\end{table}
\end{onecolumn}
\end{document}
这主要复制了我非常喜欢的 Analog Devices 应用说明(希望我没有侵犯任何版权)。
但是,这仍然不是我想要实现的,因为我无法在第二页上获取索引(尽管在第一页上也可以,这也是我喜欢的),我无法在第一页的规则上方获取公司信息,最后一页的页脚没有正确对齐。最后,我不是一个非常优秀的乳胶程序员,所以我认为一切都可以更好地安排(也许在类/样式中)。
如果可能的话,我想分享我的代码并请别人改进它。
谢谢。
编辑1: 我想出了以下中间步骤
\documentclass[a4paper,twocolumn,twoside,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[]{Chivo}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pgf, tikz}
\usepackage{mathrsfs}
\usepackage{verbatim}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{tipa} % for the pipe symbol
\usepackage[left=1.25cm,right=1.25cm,top=1.8cm,bottom=5cm]{geometry}
\usepackage{amsmath, amssymb, textcomp}
\everymath{\displaystyle}
\usepackage{eurosym}
\usepackage{graphicx}
\usepackage{svg}
\usepackage{lipsum}
\usepackage{hyperref}
% custom header/footer
\usepackage{fancyhdr}
\makeatletter
\newcommand{\logo}{\includegraphics[width=0.3\columnwidth]{logo.png}}
\newcommand{\logosmall}{\includegraphics[width=0.15\columnwidth]{logo.png}}
\newcommand{\claim}{©YYYY Company name, Inc. All rights reserved. Trademarks and registered trademarks are the property of their respective owners.}
\newcommand{\website}{www.companysite.com}
\newcommand{\telephone}{123.456.7890}
\newcommand{\address}{\small{One Technology Way}\large{$\cdot$}\small{P.O.Box 9106}\large{$\cdot$}\small{Norwood,MA02062-9106,USA}}
\renewcommand{\date}[1]{\gdef\@date{#1}}
\newcommand*{\revision}[1]{\gdef\@revision{#1}}
\newcommand*{\code}[1]{\gdef\@code{#1}}
\newcommand*{\type}[1]{\gdef\@type{#1}}
\newcommand*{\theCompany}{\textbf{{\address}\large{$\cdot$}\small{Tel:\telephone}\large{$\cdot$}\small{\website}}}
%
%
% First page
%
\fancypagestyle{first}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{94pt}
\fancyhead[C]{
\begin{tabular}[b]{p{0.3\linewidth}p{0.27\linewidth}p{0.3\linewidth}} % still having some alignment issues here
\multirow{2}{1in}{\logo} & & \\
& & \\
& & \huge{\bf{\@code}} \\
& & \huge{\bf{\@type}} \\
& & \\
\multicolumn{3}{l}{\theCompany} \\
\end{tabular}
\vspace*{-15pt}
}
\renewcommand{\headrulewidth}{2pt}
%\fancyfoot[C]{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
\fancyfoot[C]{
\begin{tabular}[b]{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
& \footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}} & \\
\end{tabular}
}
}
%
% Document body
\fancypagestyle{body}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
%
%\fancyfoot[C]{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
\fancyfoot[C]{
\begin{tabular}[b]{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
& \footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}} & \\
\end{tabular}
}
}
%
%
% Last page
\fancypagestyle{last}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{
\begin{tabular}[b]{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
& \multirow{2}{1in}{\logosmall} & \\
\footnotesize{\claim} & & \multirow{2}{1in}{\fbox{\parbox{0.3\textwidth}{\centering\large{\vspace*{10pt}\textbf{\website}\vspace*{5pt}}}}}\\
& & \\
&\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}&\\
\end{tabular}
}
}
\makeatother
% custom title
\makeatletter
\renewcommand*{\maketitle}{%
\renewcommand{\familydefault}{\sfdefault}
\thispagestyle{first}
\twocolumn[
\vspace*{-20pt}% Insert needed vertical retraction
\begin{@twocolumnfalse}
\begin{center}
\bf{
{\LARGE\@title\par}
\@author
}
\end{center}
\end{@twocolumnfalse}
\vspace*{20pt}
]
}%
\makeatother
\setcounter{secnumdepth}{0} % sections are level 1
\title{My Application Note Title}
\author{J.~Doe}
\date{22.02.2019}
\revision{Rev.~0.1}
\code{AN-1}
\type{APPLICATION~NOTE}
\begin{document}
\maketitle
\section{Introduction}
\lipsum[1]\lipsum[2]\lipsum[1]
\clearpage
\tableofcontents
\pagestyle{body}
\section{Section}
\lipsum[1]
\section{Section}
\lipsum[2]
\subsection{Subsection}
\lipsum[3]
\section{Section}
\lipsum[4]
\subsection{Subsection}
\lipsum[5]
\paragraph{Paragraph}
\lipsum[6]
\subsection{Subsection}
\lipsum[7]
\paragraph{Paragraph}
\lipsum[8]
\newpage
\clearpage
\pagestyle{last}
\begin{onecolumn}
\begin{table}[!ht]%
\caption{Revision history.}
\label{}
\centering
\begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
\hline
Revision & Author & Changes\\
\hline
cell 1 & cell 2 & cell 3\\
cell 1 & cell 2 & cell 3\\
\hline
\end{tabular}
\end{table}
\end{onecolumn}
\end{document}
现在,我在最后一页的页脚中放置了一个多行表格环境,该环境在整个文档主体中重复出现。我将尝试调整垂直对齐,以便在每一页上实现一致的页脚。
关于标题页,我使用了相同的环境(表格 + 多行)来获得正确的对齐,并且我已成功将公司地址置于水平线的正上方(感谢 @derBender)。但是仍然存在一些对齐问题。
然而“模板”还需要进一步的研究。
编辑2:
经过一些微调,我想出了这个
\documentclass[a4paper,twocolumn,twoside,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[]{Chivo}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pgf, tikz}
\usepackage{mathrsfs}
\usepackage{verbatim}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{tipa} % for the pipe symbol
\usepackage[left=1.25cm,right=1.25cm,top=1.8cm,bottom=5cm]{geometry}
\usepackage{amsmath, amssymb, textcomp}
\everymath{\displaystyle}
\usepackage{eurosym}
\usepackage{graphicx}
\usepackage{svg}
\usepackage{lipsum}
\usepackage{hyperref}
% custom header/footer
\usepackage{fancyhdr}
\makeatletter
\newcommand{\logo}{\includegraphics[width=0.3\columnwidth]{logo.png}}
\newcommand{\logosmall}{\includegraphics[width=0.15\columnwidth]{logo.png}}
\newcommand{\claim}{©YYYY Company name, Inc. All rights reserved. Trademarks and registered trademarks are the property of their respective owners.}
\newcommand{\website}{www.companysite.com}
\newcommand{\websitelast}{\fbox{\parbox{0.3\textwidth}{\centering\large{\vspace*{10pt}\textbf{\website}\vspace*{10pt}}}}}
\newcommand{\telephone}{123.456.7890}
\newcommand{\address}{\small{One Technology Way}\large{$\cdot$}\small{P.O.Box 9106}\large{$\cdot$}\small{Norwood,MA02062-9106,USA}}
\renewcommand{\date}[1]{\gdef\@date{#1}}
\newcommand*{\revision}[1]{\gdef\@revision{#1}}
\newcommand*{\code}[1]{\gdef\@code{#1}}
\newcommand*{\type}[1]{\gdef\@type{#1}}
\newcommand*{\theCompany}{\textbf{{\address}\large{$\cdot$}\small{Tel:\telephone}\large{$\cdot$}\small{\website}}}
%
% First page
%
\fancypagestyle{first}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{94pt}
\fancyhead[C]{
\begin{tabular}[b]{lcr} % still having some alignment issues here
\multirow{2}{1in}{\logo} & & \\
& & \\
& & \huge{\bf{\@code}} \\
& & \huge{\bf{\@type}} \\
& & \\
\multicolumn{3}{l}{\theCompany} \\
\end{tabular}
\vspace*{-15pt}
}
\renewcommand{\headrulewidth}{2pt}
%\fancyfoot[C]{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
\fancyfoot[C]{
\begin{tabular}[b]{lcr}
& \footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}} & \\
\end{tabular}
}
}
%
% Document body
\fancypagestyle{body}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\setlength\footskip{73pt}
%
\fancyfoot[C]{
\begin{tabular}[b]{lcr}
& & \\
& & \\
& & \\
& \footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}} & \\
\end{tabular}
}
}
%
% Last page
\fancypagestyle{last}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\setlength\footskip{73pt}
%\multirow[<vpos>]{<nrows>}[<bigstruts>]{<width>}[<vmove>]{<text>}
\fancyfoot[C]{
\begin{tabular}[b]{p{0.4\linewidth}p{0.2\linewidth}p{0.4\linewidth}}
& \multirow[]{2}*[0.1in]{\logosmall} & \\
\footnotesize{\claim} & & \multirow{2}*{\websitelast} \\
& & \\
&\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}} & \\
\end{tabular}
}
}
\makeatother
% custom title
\makeatletter
\renewcommand*{\maketitle}{%
\renewcommand{\familydefault}{\sfdefault}
\thispagestyle{first}
\twocolumn[
\vspace*{-20pt}% Insert needed vertical retraction
\begin{@twocolumnfalse}
\begin{center}
\bf{
{\LARGE\@title\par}
\@author
}
\end{center}
\end{@twocolumnfalse}
\vspace*{20pt}
]
}%
\makeatother
\setcounter{secnumdepth}{0} % sections are level 1
\title{My Outstanding Application Note Title}
\author{J.~Doe}
\date{22.02.2019}
\revision{Rev.~0.1}
\code{AN-1}
\type{APPLICATION~NOTE}
\begin{document}
\maketitle
\section{Introduction}
\lipsum[1]\lipsum[2]\lipsum[1]
\clearpage
\tableofcontents
\pagestyle{body}
\section{Section}
\lipsum[1]
\section{Section}
\lipsum[2]
\subsection{Subsection}
\lipsum[3]
\section{Section}
\lipsum[4]
\subsection{Subsection}
\lipsum[5]
\paragraph{Paragraph}
\lipsum[6]
\subsection{Subsection}
\lipsum[7]
\paragraph{Paragraph}
\lipsum[8]
\newpage
\clearpage
\pagestyle{last}
\begin{onecolumn}
\begin{table}[!ht]%
\caption{Revision history.}
\label{}
\centering
\begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
\hline
Revision & Author & Changes\\
\hline
cell 1 & cell 2 & cell 3\\
cell 1 & cell 2 & cell 3\\
\hline
\end{tabular}
\end{table}
\end{onecolumn}
\end{document}
然而索引仍然被正文所包围。
编辑3: 我对最终版本很满意
\documentclass[a4paper,twocolumn,twoside,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage[titles]{tocloft}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{tipa} % for the pipe symbol
\usepackage[left=1.25cm,right=1.25cm,top=1.8cm,bottom=5cm]{geometry}
\usepackage{amsmath, amssymb, textcomp}
\usepackage{eurosym}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{hyperref}
% custom header/footer
\usepackage{fancyhdr}
\makeatletter
\newcommand{\logo}{\includegraphics[draft,width=0.7\columnwidth]{logo.png}}
\newcommand{\logosmall}{\includegraphics[draft,width=0.2\columnwidth]{logo.png}}
\newcommand{\claim}[1]{\gdef\@claim{#1}}
\newcommand{\site}[1]{\gdef\@site{#1}}
\renewcommand{\date}[1]{\gdef\@date{#1}}
\newcommand*{\revision}[1]{\gdef\@revision{#1}}
\newcommand*{\id}[1]{\gdef\@id{#1}}
\newcommand*{\type}[1]{\gdef\@type{#1}}
\newcommand*{\info}[1]{\gdef\@info{#1}}
%
% First page
%p{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}
\fancypagestyle{first}{
%\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{94pt}
\fancyhead[C]{
\begin{tabular}[b]{lcr} % still having some alignment issues here
\multirow{2}*[-0.1in]{\logo} & & \\
& & \huge{\textbf{\textsf{\@id}}} \\
& & \huge{\textbf{\textsf{\@type}}} \\
\multicolumn{3}{b{0.95\textwidth}}{\footnotesize{\textsf{\@info}}} \\
\end{tabular}
}
\vspace*{-5pt}
\renewcommand{\headrulewidth}{2pt}
%\fancyfoot[C]{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
\fancyfoot[C]{
\begin{tabular}[b]{lcr}
& \textsf{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}} & \\
\end{tabular}
}
}
%
% Document body
\fancypagestyle{body}{
%\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\textsf{\@id}}
\hfill
\textbf{\textsf{\color{lightgray}{\@type}}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\textsf{\color{lightgray}{\@type}}}
\hfill \textbf{\textsf{\@id}}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\setlength\footskip{73pt}
%
\fancyfoot[C]{
\begin{tabular}[b]{lcr}
& & \\
& & \\
& & \\
& \textsf{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}} & \\
\end{tabular}
}
}
%
% Last page
\fancypagestyle{last}{
%\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\textsf{\@id}}
\hfill
\textbf{\textsf{\color{lightgray}{\@type}}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\textsf{\color{lightgray}{\@type}}}
\hfill \textbf{\textsf{\@id}}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\setlength\footskip{73pt}
%\multirow[<vpos>]{<nrows>}[<bigstruts>]{<width>}[<vmove>]{<text>}
\fancyfoot[C]{
\begin{tabular}[b]{p{0.4\linewidth}p{0.2\linewidth}p{0.4\linewidth}}
& \multirow[]{2}*[-0.15in]{\logosmall} & \\
\textsf{\footnotesize{\@claim}} & & \multirow[]{2}*[0.1in]{\fbox{\parbox{0.3\textwidth}{\centering\large{\vspace*{10pt}\textbf{\textsf{\@site}}\vspace*{10pt}}}}} \\
& & \\
&\textsf{\footnotesize{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}} & \\
\end{tabular}
}
}
\makeatother
% custom title
\makeatletter
\renewcommand*{\maketitle}{%
%\renewcommand{\familydefault}{\sfdefault}
\thispagestyle{first}
\twocolumn[
\vspace*{-20pt}% Insert needed vertical retraction
\begin{@twocolumnfalse}
\begin{center}
{\LARGE\textbf{\textsf{\@title}}\par}
\textbf{\textsf{\@author}}
\end{center}
\end{@twocolumnfalse}
\vspace*{20pt}
]
}%
%
\makeatother
\setcounter{secnumdepth}{0} % sections are level 1
\titleformat*{\section}{\Large\bfseries\sffamily}
\titleformat*{\subsection}{\large\bfseries\sffamily}
\titleformat*{\subsubsection}{\bfseries\sffamily}
\titleformat*{\paragraph}{\large\bfseries\sffamily}
\titleformat*{\subparagraph}{\bfseries\sffamily}
\renewcommand{\cftsecfont}{\bfseries\sffamily}
\renewcommand{\cftsubsecfont}{\sffamily}
\renewcommand{\cftsubsubsecfont}{\sffamily}
\title{My Outstanding Application Note Title}
\author{J.~Doe}
\date{22.02.2019}
\revision{Rev.~0.1}
\id{AN-1}
\type{APPLICATION~NOTE}
\info{Please place here company infos.}
\claim{Please, place here your copyright notice.}
\site{www.companysite.com}
\begin{document}
\maketitle
\tableofcontents
\clearpage
\pagestyle{body}
\section{Section}
\lipsum[1-4]
\section{Section}
\lipsum[1]
\section{Section}
\lipsum[2]
\subsection{Subsection}
\lipsum[3]
\subsubsection{Subsubsection}
\lipsum[4]
\subsection{Subsection}
\lipsum[5]
\paragraph{Paragraph}
\lipsum[6]
\subparagraph{Subparagraph}
\lipsum[7]
\newpage
\clearpage
\pagestyle{last}
\begin{onecolumn}
\begin{table}[!ht]%
\caption{Revision history.}
\label{}
\centering
\begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
\hline
Revision & Author & Changes\\
\hline
cell 1 & cell 2 & cell 3\\
cell 1 & cell 2 & cell 3\\
\hline
\end{tabular}
\end{table}
\end{onecolumn}
\end{document}
答案1
我觉得我的想法还不错……不过还有待改进
\documentclass[a4paper,twocolumn,twoside,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[]{Chivo}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pgf, tikz}
\usepackage{mathrsfs}
\usepackage{verbatim}
\usepackage{lastpage}
\usepackage{tipa} % for the pipe symbol
\usepackage[left=1.25cm,right=1.25cm,top=1.8cm,bottom=5cm]{geometry}
\usetikzlibrary{shapes, calc, shapes, arrows, babel}
\usepackage{amsmath, amssymb, textcomp}
\everymath{\displaystyle}
\usepackage{eurosym}
\usepackage{graphicx}
\graphicspath{{./img/}}
\usepackage{svg}
\usepackage{lipsum}
\usepackage{hyperref}
% custom header/footer
\usepackage{fancyhdr}
%\pagestyle{fancy}
\makeatletter
\newcommand{\logo}{\includegraphics[natwidth=100px,natheight=100px,width=0.6\columnwidth]{logo.png}}
\newcommand{\logosmall}{\includegraphics[natwidth=100px,natheight=100px,width=0.2\columnwidth]{logo.png}}
\newcommand{\claim}{©YYYY Company name, Inc. All rights reserved.\\ Trademarks and registered trademarks are the\\\vspace{-6pt} property of their respective owners.}
\newcommand{\website}{www.companysite.com}
\newcommand{\telephone}{123.456.7890}
\newcommand{\address}{\small{One Technology Way}\large{$\cdot$}\small{P.O.Box 9106}\large{$\cdot$}\small{Norwood,MA02062-9106,USA}}
\renewcommand{\date}[1]{\gdef\@date{#1}}
\newcommand*{\revision}[1]{\gdef\@revision{#1}}
\newcommand*{\code}[1]{\gdef\@code{#1}}
\newcommand*{\type}[1]{\gdef\@type{#1}}
\newcommand*{\theCompany}{\textbf{{\address}\large{$\cdot$}\small{Tel:\telephone}\large{$\cdot$}\small{\website}}}
%
%
% First page
%
\fancypagestyle{first}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
\fancyhead[L]{\logo\\}
\fancyhead[R]{
\huge{
\bf{
\@code\\
\@type\\
}
}
}
\fancyhead[C]{~\\~\\\theCompany}
\renewcommand{\headrulewidth}{2pt}
%
%\vspace*{-30pt}
\fancyfoot[C]{\tiny{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
}
%
% Document body
\fancypagestyle{body}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
%
\fancyfoot[C]{\tiny{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
}
%
%
% Last page
\fancypagestyle{last}{
\renewcommand{\familydefault}{\sfdefault}
\setlength\headheight{47pt}
%\renewcommand{\topmargin}{0pt}
% even pages
\fancyhead[CE]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\@code}
\hfill
\textbf{\color{lightgray}{\@type}}
}
\vspace*{10pt}
}}}%
% odd pages
\fancyhead[CO]{\fbox{%
\parbox{\textwidth}{
\vspace*{10pt}\huge{
\textbf{\color{lightgray}{\@type}}
\hfill \textbf{\@code}
}
\vspace*{10pt}
}}}%
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{\vspace*{-10pt}{\tiny \claim}}
\fancyfoot[C]{\vspace{-60pt}\hspace{1cm}\logosmall\\\tiny{\@revision\textpipe{}Page~\thepage~of~\pageref{LastPage}}}
\fancyfoot[R]{\fbox{%
\parbox{0.3\textwidth}{
\centering
\large{
\vspace*{10pt}
\textbf{\website}
\vspace*{5pt}
}}}\\
~
}
}
\makeatother
% custom title
\makeatletter
\renewcommand*{\maketitle}{%
\renewcommand{\familydefault}{\sfdefault}
\thispagestyle{first}
\twocolumn[
%\let\clearpage\relax% Remove \clearpage functionality
\vspace*{-10pt}% Insert needed vertical retraction
\begin{@twocolumnfalse}
\begin{center}
\bf{
{~\par}
~
}
\end{center}
\end{@twocolumnfalse}
\vspace*{90pt}
]
}%
\makeatother
\setcounter{secnumdepth}{0} % sections are level 1
\title{}
\author{}
\date{22.02.2019}
\revision{Rev.~0.1}
\code{AN-1}
\type{APPLICATION~NOTE}
\begin{document}
\maketitle
\begin{center}
%\title
%\author{J.~Doe}
\renewcommand{\title}{My Application Note Title}
\renewcommand{\author}{J.~Doe}
\Large{\textbf{\title \\ by \author}}
\end{center}
\section{Introduction}
\lipsum[1]\lipsum[2]\lipsum[1]
\clearpage
\tableofcontents
\pagestyle{body}
\section{Section}
\lipsum[1]
\section{Section}
\lipsum[2]
\subsection{Subsection}
\lipsum[3]
\section{Section}
\lipsum[4]
\subsection{Subsection}
\lipsum[5]
\paragraph{Paragraph}
\lipsum[6]
\subsection{Subsection}
\lipsum[7]
\paragraph{Paragraph}
\lipsum[8]
\newpage
\clearpage
\pagestyle{last}
\begin{onecolumn}
\begin{table}[!ht]%
\caption{Revision history.}
\label{}
\centering
\begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
\hline
Revision & Author & Changes\\
\hline
cell 1 & cell 2 & cell 3\\
cell 1 & cell 2 & cell 3\\
\hline
\end{tabular}
\end{table}
\end{onecolumn}
\end{document}
已知问题有:
-title 未在两列上方居中
-toc 不在单独页面上
- 最终页面的页脚未完全对齐(也许一些 hspaces 和 vspaces 可以在这里提供帮助?)
答案2
移动\tableofcontents
之后(而不是之前)\clearpages
对我来说很有效。
此外,这里有一些小建议:起初我在编译你的 MWE 时遇到了问题,因为 LaTeX 无法确定尺寸logo.png
(我知道即使文件存在它也无法确定),所以在这些情况下我通常会在文件中添加一个natheight=100px, natwidth=100px
(或任何其他数字,请在你的文件中检查)\includegraphics
编辑:我认为,为了让它看起来更像 AD 的应用程序注释,页脚需要做得有点不同:页脚中没有日期(所以我省略了该行),并且“第 x 页,共 y 页”位于中央,但与修订号之间用“|”隔开(存档者,\usepackage{tipa}
而且\textpipe
文本大小非常小,所以我用{\tiny…}
我临时想出了以下标志(尺寸100 px * 100 px):