Adds support for CJK, and removes the need to manuall call \recomputelengths

This commit is contained in:
Xavier Danaux
2011-11-17 19:17:16 +01:00
parent b0eaa123ba
commit f3a9342230
10 changed files with 67 additions and 56 deletions

View File

@ -1,3 +1,8 @@
version 0.14 (xx November 2011)
- adds support for CJK, thanks to the help of P. D'Apice.
- the use of \recomputelengths after modifying any length in the preamble is now
unnecessary; \recomputelength is automatically called at the start of the document.
version 0.13.1 (11 November 2011) version 0.13.1 (11 November 2011)
- correct a bug introduced by v0.13 in the classic style when no \photo is used, - correct a bug introduced by v0.13 in the classic style when no \photo is used,
as reported by S. Gislais (launchpad bug #888702). as reported by S. Gislais (launchpad bug #888702).

View File

@ -1,5 +1,5 @@
- The \cvsection command seems to be unable to handle a Chinese argument, using - When using CJK, the last \clearpage required for fancyhdr to work properly kills
CJK. the "lastpage" counter, hence also the page numbering.
- Moderncv produces an error ("lonely \item--perhaps a missing list environment") - Moderncv produces an error ("lonely \item--perhaps a missing list environment")
when used with bibentry, through the output is actually correct. Amongst other, when used with bibentry, through the output is actually correct. Amongst other,
this causes compilation by LyX to stop. this causes compilation by LyX to stop.

Binary file not shown.

View File

@ -14,12 +14,12 @@
% character encoding % character encoding
\usepackage[utf8]{inputenc} % replace by the encoding you are using \usepackage[utf8]{inputenc} % replace by the encoding you are using
%\usepackage{CJKutf8} % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean
% adjust the page margins % adjust the page margins
\usepackage[scale=0.8]{geometry} \usepackage[scale=0.8]{geometry}
%\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates %\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates
%\AtBeginDocument{\setlength{\maketitlenamewidth}{6cm}} % only for the classic theme, if you want to change the width of your name placeholder (to leave more space for your address details %\setlength{\maketitlenamewidth}{10cm}} % only for the classic theme, if you want to change the width of your name placeholder (to leave more space for your address details
%\AtBeginDocument{\recomputelengths} % required when changes are made to page layout lengths
% personal data % personal data
\firstname{John} \firstname{John}
@ -49,6 +49,7 @@
% content % content
%---------------------------------------------------------------------------------- %----------------------------------------------------------------------------------
\begin{document} \begin{document}
%\begin{CJK*}{UTF8}{gbsn} % to typeset your resume in Chinese using CJK
\maketitle \maketitle
\section{Education} \section{Education}
@ -124,6 +125,7 @@ Detailed achievements:%
%\bibliographystylemisc{plain} %\bibliographystylemisc{plain}
%\bibliographymisc{publications} % 'publications' is the name of a BibTeX file %\bibliographymisc{publications} % 'publications' is the name of a BibTeX file
%\clearpage\end{CJK*} % if you are typesetting your resume in Chinese using CJK; the \clearpage is required for fancyhdr to work correctly with CJK, though it kills the page numbering by making \lastpage undefined
\end{document} \end{document}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -125,7 +125,7 @@
% load hyperred at the end of the preamble to pass options required by loaded packages (like CJK) % load hyperred at the end of the preamble to pass options required by loaded packages (like CJK)
\AtEndPreamble{ \AtEndPreamble{
\@ifpackageloaded{CJK} \@ifpackageloaded{CJK}
{\RequirePackage[CJKbookmarks]{hyperref}} {\RequirePackage[unicode]{hyperref}}
{\RequirePackage{hyperref}} {\RequirePackage{hyperref}}
\AtBeginDocument{ \AtBeginDocument{
\hypersetup{ \hypersetup{
@ -170,8 +170,8 @@
\setlength\lineskip{1\p@} \setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@} \setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{} \renewcommand\baselinestretch{}
\setlength{\parindent}{0pt} \setlength{\parindent}{0\p@}
\setlength{\parskip}{0pt} \setlength{\parskip}{0\p@}
\setlength\columnsep{10\p@} \setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@} \setlength\columnseprule{0\p@}
\setlength\fboxsep{3\p@} \setlength\fboxsep{3\p@}
@ -232,12 +232,16 @@
\providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#1}} \providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#1}}
\providecommand*{\hintstyle}[1]{{\hintfont\color{hintcolor}#1}} \providecommand*{\hintstyle}[1]{{\hintfont\color{hintcolor}#1}}
% themes: casual (default), classic, ... % makes the cv title
\newcommand*{\maketitle}{}%
\title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title
% makes the cv footer
\newcommand*{\makefooter}
% loads a style
\newcommand*{\moderncvtheme}[2][]{ \newcommand*{\moderncvtheme}[2][]{
\def\@moderncvtheme{#2} \RequirePackage[#1]{moderncvtheme#2}}
\def\@moderncvthemeoptions{#1}}
\moderncvtheme{casual}% default theme
\AtEndPreamble{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
@ -296,11 +300,7 @@
\renewcommand{\headwidth}{\textwidth}% \renewcommand{\headwidth}{\textwidth}%
\recomputethemelengths} \recomputethemelengths}
\setlength{\hintscolumnwidth}{0.15\textwidth} \setlength{\hintscolumnwidth}{0.15\textwidth}
\recomputelengths \AtBeginDocument{\recomputelengths}
% makes the cv title
%\newcommand*{\maketitle}{}%
\title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title
% draws a colored rectangle % draws a colored rectangle
% usage: \colorrule[optional height]{width} % usage: \colorrule[optional height]{width}

View File

@ -123,26 +123,6 @@
% styles % styles
% maketitle
\renewcommand*{\maketitle}{%
{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\setlength\fboxrule{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
{\color{firstnamecolor}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
\hfill%
% \raggedleft{\firstnamestyle{\MakeLowercase{\@firstname}}\familynamestyle{\MakeLowercase{\@familyname}}}\\[-.35em]}%
\raggedleft{\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}}\\[-.35em]}%
{\color{firstnamecolor}\rule{\textwidth}{.25ex}\\[2.5em]}%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering{}\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle
% cv footer % cv footer
\newif\if@firstfooterelement\@firstfooterelementtrue \newif\if@firstfooterelement\@firstfooterelementtrue
\providecommand*{\footersymbol}{} \providecommand*{\footersymbol}{}
@ -150,7 +130,6 @@
\if@firstfooterelement% \if@firstfooterelement%
\else% \else%
{ ~~\color{footersymbolcolor}\textbullet~~~}\fi} { ~~\color{footersymbolcolor}\textbullet~~~}\fi}
\providecommand*{\makefooter}{}
\renewcommand*{\makefooter}{% \renewcommand*{\makefooter}{%
\fancypagestyle{plain}{% \fancypagestyle{plain}{%
\fancyfoot[c]{% \fancyfoot[c]{%
@ -169,7 +148,27 @@
\ifthenelse{\isundefined{\@extrainfo}}{}{\footersymbol\@extrainfo\@firstfooterelementfalse}}}% \ifthenelse{\isundefined{\@extrainfo}}{}{\footersymbol\@extrainfo\@firstfooterelementfalse}}}%
}% }%
\pagestyle{plain}} \pagestyle{plain}}
\AtBeginDocument{\makefooter}
% maketitle
\renewcommand*{\maketitle}{%
\makefooter{}%
{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\setlength\fboxrule{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
{\color{firstnamecolor}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
\hfill%
% \raggedleft{\firstnamestyle{\MakeLowercase{\@firstname}}\familynamestyle{\MakeLowercase{\@familyname}}}\\[-.35em]}%
\raggedleft{\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}}\\[-.35em]}%
{\color{firstnamecolor}\rule{\textwidth}{.25ex}\\[2.5em]}%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering{}\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\endinput \endinput

View File

@ -123,14 +123,11 @@
% styles % styles
% maketitle % maketitle
% setmaketitlenamemaxwidth to the full name length, capped by \maketitlenamemaxwidth % set \maketitlenamewidth to the desired length, or leave it up to moderncv to try to optimize it
\newlength{\maketitlenamemaxwidth} \newlength{\maketitlenamemaxwidth}
\setlength{\maketitlenamemaxwidth}{.525\textwidth} \setlength{\maketitlenamemaxwidth}{.525\textwidth}
\newlength{\maketitlenamefullwidth}
\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}
\newlength{\maketitlenamewidth} \newlength{\maketitlenamewidth}
\ifnum\maketitlenamemaxwidth<\maketitlenamefullwidth\setlength{\maketitlenamewidth}{\maketitlenamemaxwidth}\else\setlength{\maketitlenamewidth}{\maketitlenamefullwidth}\fi \setlength{\maketitlenamewidth}{0pt}
% other lengths
\newlength{\maketitlepicturewidth} \newlength{\maketitlepicturewidth}
\newlength{\maketitledetailswidth} \newlength{\maketitledetailswidth}
% recompute theme-specific lengths, called by class to recompute all lengths % recompute theme-specific lengths, called by class to recompute all lengths
@ -142,7 +139,6 @@
{\setlength{\maketitlepicturewidth}{\@photowidth} {\setlength{\maketitlepicturewidth}{\@photowidth}
\addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}% \addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}%
\addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}} \addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}}
\recomputethemelengths
\newif\if@firstdetailselement\@firstdetailselementtrue \newif\if@firstdetailselement\@firstdetailselementtrue
\newcommand*{\maketitledetailsnewline}{ \newcommand*{\maketitledetailsnewline}{
\if@firstdetailselement% \if@firstdetailselement%
@ -150,6 +146,15 @@
\else% \else%
\\[.2em]\fi} \\[.2em]\fi}
\renewcommand*{\maketitle}{% \renewcommand*{\maketitle}{%
% recompute lengths (necessary to delay the computation of \maketitlenamefullwidth until \maketitle because of potential CJK requirement in \@firstname and \@familyname)
\ifdim\maketitlenamewidth=0pt%
\newlength{\maketitlenamefullwidth}%
\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}%
\ifnum\maketitlenamemaxwidth<\maketitlenamefullwidth%
\setlength{\maketitlenamewidth}{\maketitlenamemaxwidth}%
\else%
\setlength{\maketitlenamewidth}{\maketitlenamefullwidth}\fi\fi
\recomputethemelengths{}%
% name and title % name and title
\begin{minipage}[b]{\maketitlenamewidth}% \begin{minipage}[b]{\maketitlenamewidth}%
\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}% \firstnamestyle{\@firstname~}\familynamestyle{\@familyname}%