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)
- correct a bug introduced by v0.13 in the classic style when no \photo is used,
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
CJK.
- When using CJK, the last \clearpage required for fancyhdr to work properly kills
the "lastpage" counter, hence also the page numbering.
- Moderncv produces an error ("lonely \item--perhaps a missing list environment")
when used with bibentry, through the output is actually correct. Amongst other,
this causes compilation by LyX to stop.

Binary file not shown.

View File

@ -14,12 +14,12 @@
% character encoding
\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
\usepackage[scale=0.8]{geometry}
%\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
%\AtBeginDocument{\recomputelengths} % required when changes are made to page layout lengths
%\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
% personal data
\firstname{John}
@ -49,6 +49,7 @@
% content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn} % to typeset your resume in Chinese using CJK
\maketitle
\section{Education}
@ -124,6 +125,7 @@ Detailed achievements:%
%\bibliographystylemisc{plain}
%\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}

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)
\AtEndPreamble{
\@ifpackageloaded{CJK}
{\RequirePackage[CJKbookmarks]{hyperref}}
{\RequirePackage[unicode]{hyperref}}
{\RequirePackage{hyperref}}
\AtBeginDocument{
\hypersetup{
@ -170,8 +170,8 @@
\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0\p@}
\setlength{\parskip}{0\p@}
\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}
\setlength\fboxsep{3\p@}
@ -232,12 +232,16 @@
\providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#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][]{
\def\@moderncvtheme{#2}
\def\@moderncvthemeoptions{#1}}
\moderncvtheme{casual}% default theme
\AtEndPreamble{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}
\RequirePackage[#1]{moderncvtheme#2}}
%-------------------------------------------------------------------------------
@ -296,11 +300,7 @@
\renewcommand{\headwidth}{\textwidth}%
\recomputethemelengths}
\setlength{\hintscolumnwidth}{0.15\textwidth}
\recomputelengths
% makes the cv title
%\newcommand*{\maketitle}{}%
\title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title
\AtBeginDocument{\recomputelengths}
% draws a colored rectangle
% usage: \colorrule[optional height]{width}

View File

@ -123,26 +123,6 @@
% 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
\newif\if@firstfooterelement\@firstfooterelementtrue
\providecommand*{\footersymbol}{}
@ -150,7 +130,6 @@
\if@firstfooterelement%
\else%
{ ~~\color{footersymbolcolor}\textbullet~~~}\fi}
\providecommand*{\makefooter}{}
\renewcommand*{\makefooter}{%
\fancypagestyle{plain}{%
\fancyfoot[c]{%
@ -169,7 +148,27 @@
\ifthenelse{\isundefined{\@extrainfo}}{}{\footersymbol\@extrainfo\@firstfooterelementfalse}}}%
}%
\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

View File

@ -123,14 +123,11 @@
% styles
% 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}
\setlength{\maketitlenamemaxwidth}{.525\textwidth}
\newlength{\maketitlenamefullwidth}
\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}
\newlength{\maketitlenamewidth}
\ifnum\maketitlenamemaxwidth<\maketitlenamefullwidth\setlength{\maketitlenamewidth}{\maketitlenamemaxwidth}\else\setlength{\maketitlenamewidth}{\maketitlenamefullwidth}\fi
% other lengths
\setlength{\maketitlenamewidth}{0pt}
\newlength{\maketitlepicturewidth}
\newlength{\maketitledetailswidth}
% recompute theme-specific lengths, called by class to recompute all lengths
@ -142,7 +139,6 @@
{\setlength{\maketitlepicturewidth}{\@photowidth}
\addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}%
\addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}}
\recomputethemelengths
\newif\if@firstdetailselement\@firstdetailselementtrue
\newcommand*{\maketitledetailsnewline}{
\if@firstdetailselement%
@ -150,6 +146,15 @@
\else%
\\[.2em]\fi}
\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
\begin{minipage}[b]{\maketitlenamewidth}%
\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}%