0

I have been using a CV class for a little while that has given me entire satisfaction. However, I am unable to compile it when I am trying to link a bibliography.

I believe the error has something to do with the following block in the .cls file defining the CV class:

\renewenvironment{section}[1]{
    \CV@initLength

    \vspace{\cmedskip}
    \textbf{\large #1}\par
    \rule[3mm]{\textwidth}{0.1mm}\par
    \vspace{-4mm}
    \begin{longtable}{p{\colwidth}p{\scolwidth}}

    % \end{longtable}

    % \tabularx{\linewidth}{p{\colwidth}X}
}{
%   \endtabularx
    \end{longtable}
}

When the cv.tex file is linked with its bibliography, by adding something like

\bibliographystyle{unsrt}
\bibliography{general_biblio}

then hell breaks loose. Specifically, calling

pdflatex cv.tex 
bibtex cv.aux 
pdflatextex cv.tex 
pdflatextex cv.tex 

breaks at the end of the second call to pdflatextex. The error message looks like this

/Users/me/Desktop/debug_latex/test_cv.bbl:3: LaTeX Error: \begin{longtable} on input line 1 ended by \end{thebibliography}. [\end{thebibliography}]
/Users/me/Desktop/debug_latex/test_cv.bbl:3: Missing } inserted. [\end{thebibliography}]
/Users/me/Desktop/debug_latex/test_cv.bbl:3: Missing } inserted. [\end{thebibliography}]
/Users/bbercovici/Desktop/debug_latex/test_cv.bbl:3: Missing \cr inserted. [\end{thebibliography}]
/Users/me/Desktop/debug_latex/test_cv.bbl:3: Missing { inserted. [\end{thebibliography}]
/Users/me/Desktop/debug_latex/test_cv.bbl:3: Missing } inserted. [\end{thebibliography}]
/Users/me/Desktop/debug_latex/test_cv.tex:89: LaTeX Error: \begin{longtable} on input line 1 ended by \end{document}. [\end{document}]

I have no clue where this comes from. It looks like the inclusion of the bibliography file breaks something, but I can't tell what for sure.

Any suggestions?

cv.tex

\documentclass[10pt,paperletter]{cv}
\usepackage[english]{babel} 
\usepackage{bibentry}

\Language{english}

\definecolor{urlcolor}{rgb}{0, 0, 0.5}


\Detailed{0}


\setlength{\colwidth}{2cm}

\smallskipamount=2mm    
\medskipamount=1mm      
\bigskipamount=10mm     

\geometry{
    hmargin=1.2cm,          
    vmargin=1.3cm               
}

\begin{document}

% \small
% \begin{heading}
%   \Name{XXXXXXXX}
%   \Address{XXXXXXXX}
%   \Email{XXXXX}       
%   \Nationality{XXXXX}
%   \DateOfBirth{XXXXX}
%   \Gender{XX} 
% \end{heading}

% \begin{objective}
% TEST
% \end{objective}


% \begin{section}{Education}
%   \begin{entry}

%   \end{entry}
% \end{section}

% \begin{section}{Work Experience}


% \begin{entry}
% \Date{08/2015 - 05/2016 }
%   \Place{XXXX}
% \Activity{XXXXX}
% \end{entry}



% \end{section}

% \begin{section}{Additional Skills}
% \begin{entry}
% \Skill{\underline{\textbf{Languages}}}
% \end{entry}
%   \begin{entry}
%       \Skill{XXX}
%       \Activity{XXXX}
%   \end{entry}

% \end{section}
% \newpage

% \begin{section}{Publications and Proceedings}

% \begin{entry}
% \Activity{\bibentry{Schroeder2006}}
% \end{entry}

% \end{section}

% \begin{section}{Ref}

\bibliographystyle{unsrt}
\bibliography{general_biblio}

% \end{section}



\end{document}

cv.cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cv}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\RequirePackage{ltxtable}
\RequirePackage{ifthen}
\RequirePackage{color}
\RequirePackage[
    pdftex,
    pdfstartview={XYZ 0 1000 1.0},
    bookmarks=false,
    colorlinks,
    breaklinks=true,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=urlcolor,
    pdfborder={0 0 0}
]{hyperref}

\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{longtable}

\pagestyle{empty}
\parindent=0pt

\newlength{\colwidth}

\toksdef\ta=0
\toksdef\tb=2
\def\CV@AppendItem#1#2{
    \ta={#1}
    \tb=\expandafter{#2}
    \global\edef#2{\the\tb\the\ta}
}

\newcommand{\CV@init}[1]{
    \expandafter\global\expandafter\def\csname @@#1\endcsname{}
}

\newcommand{\superscript}[1]{\ensuremath{^\textrm{\scriptsize#1}}}
\newcommand{\subscript}[1]{\ensuremath{_\textrm{\scriptsize#1}}}

\newcommand{\xst}[0]{\superscript{st}}
\newcommand{\xnd}[0]{\superscript{nd}}
\newcommand{\xrd}[0]{\superscript{rd}}
\newcommand{\xth}[0]{\superscript{th}}

\def\detailedOnly{0}
\def\@@language{}
\def\@@detailed{}

\newcommand{\Language}[1]{
    \global\def\@@language{#1}
}

\newcommand{\Detailed}[1]{
    \global\def\@@detailed{#1}
}

\newlength{\scolwidth}
\newlength{\mcolwidth}
\newlength{\cmedskip}
\newlength{\sbigskip}
\newlength{\smedskip}
\newlength{\ssmallskip}

\newcommand{\CV@initLength}{
    \setlength{\scolwidth}{\textwidth}
    \addtolength{\scolwidth}{-\colwidth}
    \addtolength{\scolwidth}{-8.72mm}       

    \setlength{\mcolwidth}{\colwidth}
    \addtolength{\mcolwidth}{\scolwidth}
    \addtolength{\mcolwidth}{4.36mm}        

    \setlength{\cmedskip}{\medskipamount}
    \addtolength{\cmedskip}{-\smallskipamount}
    \addtolength{\cmedskip}{-\baselineskip}

    \setlength{\sbigskip}{\bigskipamount}
    \addtolength{\sbigskip}{-\baselineskip}
    \setlength{\smedskip}{\medskipamount}
    \addtolength{\smedskip}{-\baselineskip}
    \setlength{\ssmallskip}{\smallskipamount}
    \addtolength{\ssmallskip}{-\baselineskip}
}

\def\@@name{}
\def\@@address{}
\def\@@telephone{}
\def\@@email{}
\def\@@emails{}
\def\@@nationality{}
\def\@@dateofbirth{}
\def\@@age{}
\def\@@gender{}
\def\@@maritalstatus{}
\def\@@drivinglicense{}

\newenvironment{heading}{
    \CV@init{name}
    \CV@init{address}   
    \CV@init{telephone}
    \CV@init{email}
    \CV@init{emails}
    \CV@init{nationality}
    \CV@init{dateofbirth}
    \CV@init{age}
    \CV@init{gender}
    \CV@init{maritalstatus}
    \CV@init{mobility}
    \CV@init{photo}
    \newcommand{\Name}[1]{\global\def\@@name{##1}}
    \newcommand{\Address}[1]{\global\def\@@address{##1}}    
    \newcommand{\Telephone}[1]{\global\def\@@telephone{##1}}
    \newcommand{\Email}[1]{\global\def\@@email{##1}}
    \newcommand{\Emails}[1]{\global\def\@@emails{##1}}
    \newcommand{\Nationality}[1]{\global\def\@@nationality{##1}}
    \newcommand{\DateOfBirth}[1]{\global\def\@@dateofbirth{##1}}
    \newcommand{\Age}[1]{\global\def\@@age{##1}}
    \newcommand{\Gender}[1]{\global\def\@@gender{##1}}
    \newcommand{\MaritalStatus}[1]{\global\def\@@maritalstatus{##1}}
    \newcommand{\Mobility}[1]{\global\def\@@mobility{##1}}
    \newcommand{\Photo}[1]{\global\def\@@photo{##1}}
}{
    \global\def\CV@delayed{}

    \CV@AppendItem{
        \hspace*{\tabcolsep}
        \begin{minipage}{0.5\linewidth}
        \vspace{-\baselineskip}     
    }{\CV@delayed}

    \ifx\@@name\empty\else
        \CV@AppendItem{{\large \@@name}\newline}{\CV@delayed}
    \fi

    \ifx\@@address\empty\else
        \CV@AppendItem{\@@address\newline}{\CV@delayed}
    \fi

    \ifx\@@telephone\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \CV@AppendItem{T�l.~: \@@telephone\newline}{\CV@delayed}
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{Telephone: \@@telephone\newline}{\CV@delayed}
        }{}
    \fi

    \ifx\@@email\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \CV@AppendItem{Email~: \href{mailto:\@@email}{\@@email}}{\CV@delayed}
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{Email: \href{mailto:\@@email}{\@@email}}{\CV@delayed}
        }{}
    \fi

    \ifx\@@emails\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \CV@AppendItem{Email 2~: \href{mailto:\@@emails}{\@@emails}}{\CV@delayed}
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{Email 2: \href{mailto:\@@emails}{\@@emails}}{\CV@delayed}
        }{}
    \fi

    \CV@AppendItem{
        \end{minipage}
        \begin{minipage}{0.3\linewidth}
%           \vspace{\baselineskip}
    }{\CV@delayed}

    \ifx\@@dateofbirth\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \ifthenelse{\equal{\@@gender}{M}}{
                \CV@AppendItem{N� le }{\CV@delayed}
            }{
                \CV@AppendItem{N�e le }{\CV@delayed}
            }
            \CV@AppendItem{\@@dateofbirth}{\CV@delayed}
            \ifx\@@age\empty\else
                \CV@AppendItem{ (\@@age{} ans)}{\CV@delayed}
            \fi
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{Date of birth: \@@dateofbirth}{\CV@delayed}
            \ifx\@@age\empty\else
                \CV@AppendItem{ (\@@age{} year old)}{\CV@delayed}
            \fi
        }{}
    \fi

    \ifx\@@nationality\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \CV@AppendItem{\newline{}Nationalit� \@@nationality}{\CV@delayed}
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{\newline{}Nationality: \@@nationality}{\CV@delayed}
        }{}
    \fi

    \ifx\@@maritalstatus\empty\else
        \ifthenelse{\equal{\@@language}{francais}}{
            \CV@AppendItem{\newline{}\@@maritalstatus}{\CV@delayed}
        }{}
        \ifthenelse{\equal{\@@language}{english}}{
            \CV@AppendItem{\newline{}Marital status: \@@maritalstatus}{\CV@delayed}
        }{}
    \fi

    \ifx\@@mobility\empty\else
        \CV@AppendItem{\newline{}\@@mobility}{\CV@delayed}
    \fi

    \ifx\@@photo\empty\else
        \CV@AppendItem{
            \end{minipage}
            \begin{minipage}{0.17\linewidth}
                \flushright
                \vspace{-\baselineskip}
                \includegraphics[height=3cm]{\@@photo}
        }{\CV@delayed}
    \fi

    \CV@AppendItem{
        \end{minipage}
        \vspace{-\baselineskip}
        \bigskip
    }{\CV@delayed}

    \aftergroup\CV@delayed
}

\newenvironment{objective}{
    \CV@initLength

    \begin{longtable}{p{\colwidth}p{\scolwidth}}

    \ifthenelse{\equal{\@@language}{francais}}{
        \large\itshape Objectif~: & \large\itshape
    }{}\ignorespaces
    \ifthenelse{\equal{\@@language}{english}}{
        \large\itshape Objective: & \large\itshape
    }{}\ignorespaces
}{
    \\
    \end{longtable}
    \medskip
}

\renewenvironment{section}[1]{
    \CV@initLength

    \vspace{\cmedskip}
    \textbf{\large #1}\par
    \rule[3mm]{\textwidth}{0.1mm}\par
    \vspace{-4mm}
    \begin{longtable}{p{\colwidth}p{\scolwidth}}

    % \end{longtable}

    % \tabularx{\linewidth}{p{\colwidth}X}
}{
%   \endtabularx
    \end{longtable}
}

\def\@@date{}
\def\@@duration{}
\def\@@place{}
\def\@@locality{}
\def\@@country{}
\def\@@activities{}
\def\@@events{}

\newcommand{\CV@add@activity}[2][1]{
    \ifthenelse{\equal{\@@detailed}{1} \or \equal{#1}{1}}{
        \ifx\@@activities\empty\else
            \CV@AppendItem{\newline}{\@@activities}
        \fi

        \CV@AppendItem{#2.}{\@@activities}
    }{}
}

\newcommand{\CV@add@event}[2][1]{
    \ifthenelse{\equal{\@@detailed}{1} \or \equal{#1}{1}}{
        \ifx\@@events\empty\else
            \CV@AppendItem{\newline}{\@@events}
        \fi

        \CV@AppendItem{#2.}{\@@events}
    }{}
}

\newcommand{\CV@add@course}[1]{
    \ifthenelse{\equal{\@@detailed}{1}}{
        \CV@AppendItem{\ensuremath{\triangleright}~#1. }{\@@courses}
    }{}
}

\newcommand{\singleEntry}[2][1]{
    \ifthenelse{\equal{\@@detailed}{1} \or \equal{#1}{1}}{
        \\\kill
        \multicolumn{2}{p{\mcolwidth}}{#2.}\\
    }{}
%   \\[\ssmallskip]
}

\newcommand{\bigSkip}{
    \\[\sbigskip]
}

\newcommand{\medSkip}{
    \\[\smedskip]
}

\newcommand{\smallSkip}{
    \\[\ssmallskip]
}

\newenvironment{entry}[1][1]{
    \global\def\@@detail{#1}

    \CV@init{date}
    \CV@init{duration}
    \CV@init{skill}
    \CV@init{place}
    \CV@init{locality}
    \CV@init{country}
    \CV@init{activities}
    \CV@init{events}
    \CV@init{courses}
    \newcommand{\Date}[1]{\global\def\@@date{##1}}
    \newcommand{\Duration}[1]{\global\def\@@duration{##1}}
    \newcommand{\Skill}[1]{\global\def\@@skill{##1}}
    \newcommand{\Place}[1]{\global\def\@@place{##1}}
    \newcommand{\Locality}[1]{\global\def\@@locality{##1}}
    \newcommand{\Country}[1]{\global\def\@@country{##1}}
    \let\Activity\CV@add@activity
    \let\Event\CV@add@event
    \let\Course\CV@add@course
}{
    \global\def\CV@delayed{}    
    \CV@AppendItem{\\\kill}{\CV@delayed}

    \ifthenelse{\equal{\@@detailed}{1} \or \equal{\@@detail}{1}}{
        \ifx\@@date\empty\else
            \CV@AppendItem{\textbf{\@@date}}{\CV@delayed}
            \ifx\@@duration\empty\else
                \CV@AppendItem{\newline}{\CV@delayed}
            \fi
        \fi

        \ifx\@@duration\empty\else
            \CV@AppendItem{(\@@duration)}{\CV@delayed}
        \fi

        \ifx\@@skill\empty\else
            \CV@AppendItem{\@@skill}{\CV@delayed}
        \fi

        \CV@AppendItem{&}{\CV@delayed}

        \ifx\@@place\empty\else
            \CV@AppendItem{\textsc{\@@place}}{\CV@delayed}
            \ifx\@@locality\empty\else
                \CV@AppendItem{, \@@locality}{\CV@delayed}
            \fi
            \ifx\@@country\empty\else
                \CV@AppendItem{, \@@country}{\CV@delayed}
            \fi
            \CV@AppendItem{.}{\CV@delayed}

            \ifthenelse{\equal{\@@activities}{\empty} \and \equal{\@@events}{\empty} \and \equal{\@@courses}{\empty}}{}{
                \CV@AppendItem{\newline}{\CV@delayed}
            }   
        \fi

        \ifx\@@activities\empty\else
            \CV@AppendItem{\@@activities}{\CV@delayed}

            \ifthenelse{\equal{\@@events}{\empty} \and \equal{\@@courses}{\empty}}{}{
                \CV@AppendItem{\newline}{\CV@delayed}
            }   
        \fi

        \ifx\@@events\empty\else
            \CV@AppendItem{\@@events}{\CV@delayed}

            \ifthenelse{\equal{\@@courses}{\empty}}{}{
                \CV@AppendItem{\newline}{\CV@delayed}
            }   
        \fi

        \ifx\@@courses\empty\else
            \CV@AppendItem{\textit{\@@courses}}{\CV@delayed}
        \fi

        \CV@AppendItem{\\[\smallskipamount]}{\CV@delayed}
    }{}

    \aftergroup\CV@delayed
}

general_biblio.bib

@book{Schroeder2006,
author = {Schroeder, Will and Martin, Ken and Lorensen, Bill},
editor = {Kitware},
title = {{The Visualization Toolkit}},
year = {2006}
}
0

The bibliography environment uses \section*{\refname} for the title and as your class redefines \section but doesn't setup a suitable bibliography environment everything breaks. You can try this patch:

\usepackage{xpatch}
\xpatchcmd{\thebibliography}{\section*{\refname}}{}{}{\fail}

It will remove the title from the thebibliography environment.

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.