1

I am using the CV class defined like this:

%% Copyright (c) 2003-2009 Fr????ic Meynadier  
%% Original : Eric-Olivier Le Bigot
%% Modifs : Fr????ic Meynadier (Frederic.Meynadier@obspm.fr)
%% Modifs : Dominique Quatravaux (dom@idealx.com) - conversion en
%%     classe de document.
%% 03/01/03
%% Modifs : application d'un patch de Jonas Kahn, 2007-12-19
%% Modifs : anonymisation de l'exemple en commentaire, 2009-02-25

%% Permission is hereby granted, free of charge, to any person obtaining a
%% copy of this software and associated documentation files (the
%% "Software"), to deal in the Software without restriction, including
%% without limitation the rights to use, copy, modify, merge, publish,
%% distribute, sublicense, and/or sell copies of the Software, and to
%% permit persons to whom the Software is furnished to do so, subject to
%% the following conditions:

%% The above copyright notice and this permission notice shall be included in
%% all copies or substantial portions of the Software.

%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
%% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
%% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
%% IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
%% CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
%% TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
%% SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cv}
  [2002/01/03 v0.1 Curriculum Vitae package]

\LoadClass[11pt]{article}
\RequirePackage{ifthen}
\RequirePackage{array}

   %%%%%%%%%%%%%%%%%%%%%%%%%%%
   % Mise en page par d??aut %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\textwidth}{160mm}    %% Largeur de la zone texte
\setlength{\oddsidemargin}{0mm}  %% Texte centr??sur la page

\pagestyle{empty} % pour ne pas indiquer de num??o de page...

% On d??init les pieds de page comme des \stretch de force 1,
% soit 4 plus fort que celui qui est en bas du chapeau
% (Cf. ci-dessous). De cette fa??n, un CV qui ne remplit pas toute la
% page a un bel espacement.
\makeatletter
\def\@textbottom{\vspace*{\stretch{1}}}
\makeatother


   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %      Param??res r??lables          %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% L'utilisateur peut les red??inir ceux-ci ?\renewcommand? si besoin :

\newcommand{\espaceInterRubrique}{\medskip\vspace{\stretch{0.1}}}

% L'utilisateur peut les red??inir ceux-ci ?\setlength? si besoin :

\newlength{\rubriquetableauparindent} % indentation au d??ut d'une
% ligne de droite dans un ?rubriquetableau?. Cette longueur peut
% ??re n??ative, auquel cas l'alignement dans le tableau se fait
% compte tenu du retrait de la premi??e ligne : celle-ci ne ?bavera?
% pas sur l'espace r??erv??pour la colonne de gauche, au lieu de cela,
% l'ensemble de la colonne de droite est d??al??de l'espace correspondant.

\setlength{\rubriquetableauparindent}{0pt}


   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %     Macros pratiques       %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\er{$^{\hbox{er}}$}
\def\ere{$^{\hbox{??e}}$}
\def\eme{$^{\hbox{??e}}$}

   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % L'environnement "rubrique" %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Usage : \begin{rubrique}[Indentation]{Titre} [...] \end{rubrique}
% On met le texte qu'on veut ??l'int??ieur.

\newenvironment{rubrique}[1]   % "rubrique" prend un seul argument, le titre
{\espaceInterRubrique\relax%
\noindent\textbf{\large #1}\par%
\noindent\rule[0.5ex]{\textwidth}{0.1mm}\par}{}

   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % L'environnement "rubriquetableau" %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Il sert ??rendre les tableaux, avec typiquement des dates ??gauche
% et des activit?? ??droite. Il s'utilise comme ?rubrique?
% ci-dessus, sauf qu'il admet un argument optionnel qui est la largeur
% de la colonne de gauche, et que l'int??ieur doit ??re un tableau
% LaTeX avec les ?&? et les ?\\? qui vont bien.
% Par exemple :
%
% \begin{rubriquetableau}[3.5cm]{pipotage}
% 1999--2000    & ligne 1\\
%       & ligne 2\\
% 1998--1999    & ligne 1\\
% [etc...]
% \end{rubriquetableau}
%
% Lorsqu'on omet le param??re entre crochets, cela a pour effet
% de donner la dimension \linewidth ??la premi??e colonne (mais la
% structure reste celle d'un tableau ??deux colonnes, donc ne pas oublier 
% d'??rire '\\' pour les retours ??la ligne).

\makeatletter

\newlength{\@cvlenB}\newlength{\@cvlenC}

\newenvironment{rubriquetableau}[2][\linewidth]%% "rubriquetableau" 
%                       % prend deux arguments
{\bgroup\rubrique{#2}%     % le second argument : titre
\setlength{\@cvlenB}{#1}%  % Le premier argument :indentation
\setlength{\@cvlenC}{\linewidth}%          % Calculs...
\ifthenelse{\lengthtest{\rubriquetableauparindent<0pt}}
   {\addtolength{\@cvlenC}{\rubriquetableauparindent}}
   {}
\addtolength{\@cvlenC}{-\@cvlenB}
\addtolength{\@cvlenC}{-41pt}
\begin{tabular}[t]{p{\@cvlenB}!{
   \ifthenelse{\lengthtest{\rubriquetableauparindent<0pt}}
          {\hspace*{-\rubriquetableauparindent}}
          {}
    }>{\setlength{\parindent}{\rubriquetableauparindent}}p{\@cvlenC}}}
{\end{tabular}\egroup}

\makeatother

   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %    Le chapeau du CV        %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{adresse}{
\begin{minipage}{5cm}
}
{
\end{minipage}\hfill}

\newenvironment{etatcivil}{
\begin{minipage}{10cm}

}
{
\end{minipage}}

\newenvironment{chapeau}{
\def\ligne{\rule[2pt]{24pt}{1pt}}
\noindent\begin{minipage}{\linewidth}\hspace{0cm}
}
{\end{minipage}\vspace{\stretch{0}}}

I would like to include it in a book class, and so I would like to have the same margins (double-sided). I set the length of my odd and even margins and add twoside when defining my documentclass. Minimal example:

\documentclass[twoside, a4paper, 11pt]{cv}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\setlength{\textwidth}{146.8mm} 
\setlength{\oddsidemargin}{11.6mm} 
\setlength{\evensidemargin}{0.8mm} 
\setlength{\topmargin}{-2.2mm} 
\setlength{\textheight}{221.9mm} 
\usepackage{lipsum}

\newcommand{\lieu}[1]{{#1}\ }
\newcommand{\activite}[1]{\textbf{#1}\ }
\newcommand{\comment}[1]{\textsl{#1}\ }

\begin{document}

\makeatletter
\def\@maketitle{%
  \newpage
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\makeatother

\title{Curriculum Vitae}
\date{}

    %%%%%%%%%%%%%%%%%%
    % HEADER %
    %%%%%%%%%%%%%%%%%%

\begin{chapeau}
\begin{adresse}
    Name
\end{adresse}
\begin{etatcivil}
    other stuff
\end{etatcivil}
\vspace{0.6cm}

\end{chapeau}

    %%%%%%%%%%%%%%%%%%
    % CONTENT %
    %%%%%%%%%%%%%%%%%%

\begin{rubriquetableau}[3cm]{Education}

2011--2015  & \activite{A job}
    \lieu{In a cool place}

\end{rubriquetableau}

\begin{rubrique}{Experience}

Some text

\lipsum[1-2]

\lipsum[1-2]

\end{rubrique}

\begin{rubrique}{Skills}

More text

\lipsum[1-2]

\lipsum[1-2]

\end{rubrique}

\end{document}

It does not work. All margins are similar. What is wrong with my approach?

  • You would be better to use something like geometry than setting the page dimensions manually. This seems an odd class. Why does it use \makeatletter? It should pass options on to article.cls when it loads it rather than just throwing them away. It fails, basically, to do the elementary things which any class file should do. – cfr Oct 18 '15 at 1:28
1

The solution is the following:

  • Change \LoadClass[11pt]{article} to \LoadClass[twoside, 11pt]{article} in the cls file
  • Remove the original \setlength from the cls file: \setlength{\textwidth}{160mm} \setlength{\oddsidemargin}{0mm} and replace them by the \setlength from the tex file: \setlength{\textwidth}{146.8mm} \setlength{\oddsidemargin}{11.6mm} \setlength{\evensidemargin}{0.8mm} \setlength{\topmargin}{-2.2mm} \setlength{\textheight}{221.9mm} \setlength{\headheight}{14pt})

By defining the double-sided format directy in the cls file, it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.