我正在努力在 Latex 中重现以下布局。我尝试使用包 marginnote,并尝试使用 geometry 和 fancyhdr。我最终绕了一圈又一圈,做对了一点,然后又破坏了其他方面。
- 该页面是除第一页和最后一页之外的所有页面的默认样式。
- 页边距中的蓝色框是当前章节的标题。
- 每次部分发生变化时都应该出现蓝色框。
- 理想情况下,如果当前部分有多页,蓝色框也会出现在每个新页面上。
任何帮助将不胜感激!
亲切的问候,
缺口
% -*- program: xelatex -*-
\documentclass[a4paper,10pt]{article}
%\usepackage{aca_report_digital}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel}
\usepackage{fontspec}
\newfontfamily\kelsonSans{Kelson Sans Regular}
\newfontfamily\museoSansB{Museo Sans 700}
\newfontfamily\museoSansSB{Museo Sans 500}
\newfontfamily\museoSansR{Museo Sans 300}
\usepackage{xcolor}
\definecolor{acagrey}{cmyk}{0.50, 0.36, 0.44, 0.20}
\definecolor{acablue}{cmyk}{0.77, 0.64, 0.42, 0.59}
\definecolor{acaoverlay}{cmyk}{0.100, 0.83, 0.68, 0.83}
\usepackage{tikz}
\usepackage{graphicx}
\def\acalogo{\hspace*{-0.0in} \includegraphics[width=50mm]{aca_logo.eps}}
\def\acaicon{\hspace*{-0.0in} \includegraphics[width=12.75mm]{aca_icon.eps}}
\usepackage{marginnote}
\reversemarginpar % To put the margin pars on the left
\renewcommand*{\marginfont}{\normalfont\normalsize}
\setlength{\marginparwidth}{5cm}
\author{Nick}
\date{} % Activate to display a given date or no date
\usepackage{geometry}
\geometry{
lmargin=2.0cm, % Left margin on odd-numbered pages.
rmargin=2.0cm, % Left margin on even-numbered pages.
bmargin=4.39cm,
tmargin=6.3cm,
marginparwidth=4.6cm,
marginparsep=3mm,
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lhead{\noindent\acaicon}
\lfoot{\museoSansR\fontsize{8pt}{0pt}\selectfont Foo Chartered Accountants\museoSansB\selectfont\space NFP Financial Accounting Template\museoSansR\selectfont\space 2015}
\rfoot{\museoSansR\fontsize{8pt}{0pt}\selectfont Page \thepage}
\begin{document}
\tableofcontents
\section*{About\marginnote{About}}
Foo
\subsection{Best Practices}
\subsection{Version Information}
\section{System Requirements}
\section{Getting Started}
\section{Income}
\section{Expenses}
\section{Bank Statement}
\section{Membership}
\section{Reporting}
\subsection{Filtering}
\subsection{Detailed Transaction Report}
\subsection{Transaction Summary Report}
\section{Customisation}
\end{document}
答案1
我不确定我是否正确理解了您的要求,但这里为您提供了一个起点titlesec.sty
。这个想法是将您的蓝色框挂接到具有 0pt 宽度/高度环境的titletoc.sty
新页面样式中,以便使用命令将蓝色框定位在页面上。main
picture
\put
\documentclass[a4paper,10pt,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern,lipsum,xcolor,geometry}
\geometry{%
lmargin=5.0cm,
rmargin=2.0cm,
bmargin=4.39cm,
tmargin=6.3cm,
marginparwidth=4.6cm,
marginparsep=3mm,
}
\usepackage[pagestyles]{titlesec}
\titleformat{\section}[hang]
{\huge\sffamily}
{}
{0pt}{}[\vspace*{-1ex}\rule{1\linewidth}{3pt}]
\titleformat{\subsection}[hang]
{\large\bfseries\sffamily}
{}
{0pt}{}
\newpagestyle{main}[\sffamily]{%
\sethead
{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)
\put(-48,-20){%
\makebox(0,0)[l]{%
\colorbox{blue}{%
\parbox[c][1cm][c]{4.5cm}{%
\color{white}\hspace*{2em}\LARGE\sectiontitle}%
}%
}%
}%
\end{picture}%
}
{}
{}
\setfoot{}{}{\footnotesize Page~\thepage}
}
\pagestyle{main}
\usepackage{titletoc}
\titlecontents{section}[0em]
{\addvspace{0.3pc}\bfseries\filright}
{}{\hspace*{0em}}
{\mdseries\titlerule*[0.7pc]{.}\bfseries\contentspage}
\titlecontents{subsection}[4em]
{\addvspace{0.1pc}\filright}
{}{\hspace*{0em}}
{\titlerule*[0.7pc]{.}\contentspage}
\begin{document}
\tableofcontents
\clearpage
\section{About}
\lipsum
\subsection{Version Information}
\lipsum
\section{Best Practices}
\end{document}