# Section Titles in Margin Notes

I am struggling to reproduce the following layout in Latex. I have tried using the package marginnote, and playing around with geometry and fancyhdr. I end up going around and around in circles, getting one bit right, then breaking some other aspect.

• This page is the default style for all pages except the first and last.
• The Blue Box in the margin is the current section title.
• The blue box should appear every time the section changes.
• Ideally the blue box would also appear each new page if the current section is multipage.

Any help would be greatly appreciated!

Kind Regards,

Nick

% -*- 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{}
\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

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}
• Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question.
– user31729
Jul 21 '15 at 6:46
• Thanks for the suggestion. The code posted has been stripped to the problem at hand, eg the layout. I have not progressed so far as to draw the blue bounding box. Jul 21 '15 at 7:00

I'm not sure if I understood your requirements correctly, but here a starting point for you with titlesec.sty and titletoc.sty. The idea is to hook your blue boxes into a new page style main with a 0pt width/height picture environment to position the blue box on the page with a \put command.

\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]{%
{%
\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]
{}{\hspace*{0em}}
{\mdseries\titlerule*[0.7pc]{.}\bfseries\contentspage}

\titlecontents{subsection}[4em]
{}{\hspace*{0em}}
{\titlerule*[0.7pc]{.}\contentspage}

\begin{document}
\tableofcontents
\clearpage