[Tex/LaTex] Pagebreak in left column (Friggeri CV): There’s no line here to end

friggeri-cvheader-footerpage-breakingtwo-column

I am using Friggeri's CV Template and was wondering whether it would be possible to make a pagebreak or columnbreak to write something in the left column in the second page.

I have tried \pagebreak, \newpage, \columnbreak… I have tried \vfill and \leavevmode before and still nothing… I always get the error:

 There's no line here to end.

I would also want to write things in the left column in subsequent pages, and at different heights, so a plus would be not only make the columnbreak, but select the vertical position in the page…

Using the same friggeri-cv.cls (I have only changed all the Helvetica fonts to Arial and added backend=biber to the \RequirePackage{biblatex} line), here is a MWE:

%!TEX TS-program = xelatex
\documentclass[]{friggeri-cv}
\listfiles
\addbibresource{bibliography.bib}

\usepackage{lipsum}

\begin{document}
\header{name}{surname}
       {occupation}

% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    aaa
    bbb
    ccc
    ddd
\end{aside}

\section{summary}
\lipsum
\lipsum

\end{document}

The objective would be to add another section in the left column at the top of the 2nd page, and yet another section in that column at the bottom of the 3rd page… Any help would be appreciated! Many thanks!

EDIT:
Following up with this, I have made a footer, but it spans only the length of the right column.

Any idea on how to make it span the whole length of the page?

Or better yet, to do so only in the last page?

Or even better, to leave the footer as is, and create another footer for the left column that only appears in the last page?

A MWE as the one above, but including the footer, would be:

%!TEX TS-program = xelatex
\documentclass[]{friggeri-cv}
\listfiles
\addbibresource{bibliography.bib}

\usepackage{lipsum}


%%%%%%%%%%
% Footer %
%%%%%%%%%%
\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
\setlength{\footskip}{50pt}
\fancyfoot[L]{\textbf{Name Surname}}
\fancyfoot[C]{\textit{Occupation}}
\fancyfoot[R]{\thepage\ of \pageref{LastPage}}
%%%%%%%%%%%


\begin{document}
\header{name}{surname}
       {occupation}

% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    aaa
    bbb
    ccc
    ddd
\end{aside}

\section{summary}
\lipsum
\lipsum

\end{document}

Best Answer

The Friggeri class uses the textpos package to absolutely position elements such as the side-bar on the page. These absolutely positioned elements thus also define the visual extent of the "page", and hence will be key if you want to align your footer over the entire "page" rather than just under the main text block.

Custom Positioning of Sidebar Items: The contents of the side-bar are typeset in an absolutely positioned block (using the textpos package. This makes your attepts at using \clearpage etc. within the aside environment fail. Instead, you need to a new aside in your document sometime after you get to the second page (i.e. after a \clearpage command that appears in your main text). That being said, if you do this, you will end up with a second aside that is too low on the page: the Friggeri class hardcodes the position to appear below the (now non-existent) header.

Here is an idea that might help. Replace the \begin{aside} environment with something that uses \marginnote{} from the marginnote package. This will allow you to position material in the margin at a specific position in accordance with where the command is issued. This should give you much more control.

A limitation of this solution is that you will first have to design the main content, then insert the asidenow content in the appropriate place so that it is positioned in the margin appropriately. With the optional argument you can manually adjust the vertical position just as with the \marginnote{} command. However, for a CV, one should probably manually tweak many things, so these adjustments are probably an acceptable limitation.

To enable a "full page" footer, you need to know how far to extend it to the left with the \fancyfootoffset[L]{4.6cm} command. I show below how to figure this out from the friggeri-cv.cls code.

Extending the Footer: You should be able to use the \fancyfootoffset command in appropriate places to get your desired output. Here I extend the offset for the second (and subsequent) pages. I suggest you ask a new question if you need generic code that automatically applies this only to the last page. (Again, assuming you are using this for a CV, a bit of tweaking about where the command is inserted to make it affect only the last page should not be a problem.)

%!TEX TS-program = xelatex
\documentclass[]{friggeri-cv}
\listfiles
\usepackage{lipsum}


% Use the marginnote package to defined a new asidenow environment for
% custom positioning of sidebar elements.
\usepackage{calc}
\usepackage{marginnote}
\reversemarginpar           % Use the left side, not the default right side

% Compute the margin par separation and width to match the aside
% environment as defined in friggeri-cv.cls 
\setlength{\marginparsep}{6.1cm - 1.5cm - 3.6cm}
\setlength{\marginparwidth}{3.6cm}

% The environ package allows one to gather the contents of the environment
% so they can be passed to the \marginnote command through the \BODY macro.
\usepackage{environ}
\NewEnviron{asidenow}[1][0pt]{%
  \let\oldsection\section
  \renewcommand{\section}[1]{
    {\Large\headingfont\color{headercolor} ##1}\par
  }
  \marginnote{
    \vspace{-\baselineskip}
    \begin{flushright}
      \BODY
    \end{flushright}
  }[#1]
  \let\section\oldsection
}

% Footer
\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
\setlength{\footskip}{50pt}
\fancyfoot[L]{\textbf{Name Surname}}
\fancyfoot[C]{\textit{Occupation}}
\fancyfoot[R]{\thepage\ of \pageref{LastPage}}

\begin{document}
\header{name}{surname}
       {occupation}

% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    aaa
    bbb
    ccc
    ddd
\end{aside}

\section{summary}
\lipsum[1-4]

\clearpage                  % Clear the page in the main body
\fancyfootoffset[L]{4.6cm}  % Add left offset to match width of sidebar

\begin{asidenow}[0.35em] % Tweak vertical positioning like this
  \section{Top}
  This aside appears at the top of the second page because it appears at
  the top of the ``details'' section in the text which starts on a new
  page.\\  % Need \\ to force line breaks now
  bbb\\
  ccc
\end{asidenow}

\section{details}
\lipsum[1-2]
\begin{asidenow}
  \section{Here}
  This section is positioned in the middle of the text.
\end{asidenow}
\lipsum[3-4]

\end{document}

Sample output of second page showing custom sidebars and wide footer

Details and Limitations

  • Everything is rather manual here: you will need to tweak the spacing and positioning of things to get it to look right. For a CV this should not be a problem since you need to examin all details anyway to make it perfect. If you want to reuse this code for many projects, however, then you will need to make some decisions about the desired spacings, and should calculate things exactly as needed.

    For example, the spacing is not exactly the same as in the aside environment (in particular the spacing between the section head and text). Also, the vertical spacing should be tweaked somewhat so that the default positioning is exactly consistent with the style. Right now it needs manual tweaks.

  • I have not figured out a good way of getting newlines in the asidenow environment to work automatically as in the aside environment, so you need to use \\ for now if you want a new line. This might be considere a feature, however:-)

  • There might be a solution that allows you to use \clearpage commands etc. within a sidebar environment as you suggested, but I think this would likely be much harder to implement.

To figure out exact spacings etc. look at the friggeri-cv.cls file. Here is the relevant code defining the aside environment and the page geometry. I used these to get the various dimensions for the \marginparwidth, \marginparsep and \fancyfootoffset:

\RequirePackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}
\newenvironment{aside}{%
  \let\oldsection\section
  \renewcommand{\section}[1]{
    \par\vspace{\baselineskip}{\Large\headingfont\color{headercolor} ##1}
  }
  \begin{textblock}{3.6}(1.5, 4.33)
  \begin{flushright}
  \obeycr
}{%
  \restorecr
  \end{flushright}
  \end{textblock}
  \let\section\oldsection
}

...

\RequirePackage[left=6.1cm,top=2cm,right=1.5cm,bottom=2.5cm,nohead,nofoot]{geometry}

The first code defines the side-bar to be 3.6cm wide starting at 1.5cm from the left of the page (and 4.33cm from the top which places it below the header). The second chunk of code uses the geometry package to set the page geometry with a left margin of 6.1cm. Thus, you need to extend the footer by (6.1-1.5)cm = 4.6cm to have it fill the entire page.

Related Question