4

I am using a template found online to do my CV and I am getting a hard time trying to spred the content of a newenvironment over two pages. I want the content of one of my rubrique to be over the end of a page and the beginning of the next one instead of having everything on the second page. My document look like the following code. Thanks for any advices.

\newcommand{\ligne}[1]{\rule[0.5ex]{\textwidth}{#1}\\}
\newcommand{\interRubrique}{\bigskip}
\newcommand{\styleRub}[1]{\noindent\textbf{\large #1}\par}
\newcommand{\indentStd}{\noindent\hspace{\lenA}}

\newenvironment{rubrique}[2][\linewidth] {
    \styleRub{#2}
    \setlength{\lenB}{#1}
    \setlength{\lenC}{\linewidth}
    \addtolength{\lenC}{-\lenA}
    \addtolength{\lenC}{-\lenB}
    \addtolength{\lenC}{-\parindent}
    \addtolength{\lenC}{-1pt}
    \indentStd\begin{tabular}[t]{p{\lenB}p{\lenC}}
}

\newcommand{\lieu}[1]{{\textmd{\textsl{#1}}\ }}
\newcommand{\activite}[1]{\textmd{\textbf{#1}}\ }
\newcommand{\comment}[1]{\textmd{#1}\ }
\pagestyle{empty} % pour ne pas indiquer de numro de page...


\begin{document}

\newlength{\lenA} % indentation au dbut d'une ligne
\setlength{\lenA}{0.cm}
\newlength{\lenB} % Taille champ dates
\newlength{\lenC} % Taille champ description

\interRubrique 

\begin{rubrique}[15cm]{Education}
  \ligne{0.1mm} 
  \activite{Ph.D. Candidate} \comment{(blabla)} 
  & 2009 - current \\
  \lieu{Memorial University of Newfoundland
          , St John's, NL, Canada}\\
      \\      
      \activite{Master of Science}\comment{(Earth)} 
\end{rubrique}

\interRubrique 

\begin{rubrique}[15cm]{Professional experience}
    \ligne{0.1mm}
    \activite{Aaaaaa}
            &2011 (1 week)\\ 
            \lieu{  Pasadena} 
            \begin{itemize}
            \item[$\bullet$] \comment{Build a new
              international collaboration ...}
           \end{itemize}          
            \\
    \activite{Research assistant}
    & 2008 (6 months)  \\
            \lieu{Laboratoire}
            \begin{itemize}
            \item[$\bullet$] \comment{Analysed ...} 
            \end{itemize}          
            \\
    \vspace{0.2cm}\\
\end{rubrique}
\end{document}
2
  • 1
    Please post complete code i.e. a complete small document which will compile. Yours will not because it lacks, for example, a document class and possibly required packages. Check that it compiles before posting it.
    – cfr
    Commented Apr 13, 2014 at 1:09
  • Welcome to TeX.SE. As @cfr suggested, it would be very helpful if you completed your code to be a fully compilable MWE including \documentclass and the appropriate packages that reproduces the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Commented Apr 13, 2014 at 2:55

1 Answer 1

5

First of all, the definition of rubrique, being a new environment, lacks the ending part...

Then, it is defined with a tabular inside it, which is not allowed to break into pages.

The solution may be to load the package longtable

\usepackage{longtable}

and to substitute tabular with longtable in the definition of rubrique:

\newenvironment{rubrique}[2][\linewidth]{%
    \styleRub{#2}
    \setlength{\lenB}{#1}
    \setlength{\lenC}{\linewidth}
    \addtolength{\lenC}{-\lenA}
    \addtolength{\lenC}{-\lenB}
    \addtolength{\lenC}{-\parindent}
    \addtolength{\lenC}{-1pt}
    \indentStd\begin{longtable}[t]{p{\lenB}p{\lenC}}
    }{%
    \end{longtable}%
    }

MWE (I've used article class and geometry with landscape option not knowing your document class):

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{longtable}

\newcommand{\ligne}[1]{\rule[0.5ex]{\textwidth}{#1}\\}
\newcommand{\interRubrique}{\bigskip}
\newcommand{\styleRub}[1]{\noindent\textbf{\large #1}\par}
\newcommand{\indentStd}{\noindent\hspace{\lenA}}

\newenvironment{rubrique}[2][\linewidth]{%
    \styleRub{#2}
    \setlength{\lenB}{#1}
    \setlength{\lenC}{\linewidth}
    \addtolength{\lenC}{-\lenA}
    \addtolength{\lenC}{-\lenB}
    \addtolength{\lenC}{-\parindent}
    \addtolength{\lenC}{-1pt}
    \indentStd\begin{longtable}[t]{p{\lenB}p{\lenC}}
    }{%
    \end{longtable}%
    }

\newcommand{\lieu}[1]{{\textmd{\textsl{#1}}\ }}
\newcommand{\activite}[1]{\textmd{\textbf{#1}}\ }
\newcommand{\comment}[1]{\textmd{#1}\ }
\pagestyle{empty} % pour ne pas indiquer de numro de page...


\begin{document}

\newlength{\lenA} % indentation au dbut d'une ligne
\setlength{\lenA}{0.cm}
\newlength{\lenB} % Taille champ dates
\newlength{\lenC} % Taille champ description

\interRubrique

\begin{rubrique}[15cm]{Education}
  \ligne{0.1mm}
  \activite{Ph.D. Candidate} \comment{(blabla)}
  & 2009 - current \\
  \lieu{Memorial University of Newfoundland
          , St John's, NL, Canada}\\
      \\
      \activite{Master of Science}\comment{(Earth)}
\end{rubrique}

\vspace{8cm}

\begin{rubrique}[15cm]{Professional experience}
    \ligne{0.1mm}
    \activite{Aaaaaa}
            &2011 (1 week)\\
            \lieu{  Pasadena}
            \begin{itemize}
            \item[$\bullet$] \comment{Build a new
              international collaboration ...}
           \end{itemize}
            \\
    \activite{Research assistant}
    & 2008 (6 months)  \\
            \lieu{Laboratoire}
            \begin{itemize}
            \item[$\bullet$] \comment{Analysed ...}
            \end{itemize}
            \\
    \vspace{0.2cm}\\
\end{rubrique}

\end{document} 

Output

enter image description here

As you can see, the contents of the second rubrique is split in two pages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .