
我正在使用 Moderncv 類別(http://www.ctan.org/pkg/moderncv)來寫我的履歷。為了修改地址部分,我修改了moderncvstyleclassic.sty。
我想讓地址部分的文字左對齊(有效),但現在我遇到了地址(addressstreet)的第一行縮排的問題。
我的問題是:如何防止此資訊框中第一行的縮排
到目前為止我還沒有找到解決這個問題的方法。
代碼在現代cvstyle經典.sty我的改變評論:
%% code above omitted
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}l@{}}%% MY MODIFICATION <<-- l for left-justified (instead of "r")
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\@addressstreet%\addresssymbol##
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@countryinfo}}{}{\makenewline\@countryinfo}%%##moved up to use as country
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{%
\ifthenelse{\equal{\@homepagetitle}{}}% \homepagetitle could be empty
{\makenewline\homepagesymbol\httplink{\@homepage}}%
{\makenewline\homepagesymbol\httplink[\@homepagetitle]{\@homepage}}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%##moved up to use as country
\end{tabular}
}%
%% code below omitted
答案1
使用\patchcmd
巨集:
\makeatletter
\patchcmd{\makecvtitle}{@{}r@{}}{@{}l@{}}{}{}
\patchcmd{\makecvtitle}{\makenewline\addresssymbol\@addressstreet}{\addresssymbol\@addressstreet\makenewline}{}{}
\makeatother
在樣式聲明之後。
前:
後:
或者,如果您想手動編輯 .sty 檔案(不鼓勵),只需更改:
\makenewline\addresssymbol\@addressstreet
到:
\addresssymbol\@addressstreet\makenewline
為了將 extrainfo 也放在 city 下面,請使用以下命令集而不是前面的命令集:
\makeatletter
\patchcmd{\makecvtitle}{@{}r@{}}{@{}l@{}}{}{}
\patchcmd{\makecvtitle}{\makenewline\addresssymbol\@addressstreet}{\addresssymbol\@addressstreet\makenewline}{}{}
\patchcmd{\makecvtitle}{\makenewline\@extrainfo}{}{}{}
\patchcmd{\makecvtitle}{\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}{\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}\makenewline\@extrainfo}{}{}
\makeatother
結果:
該country
欄位是可選的,如果您設定address
如下:
\address{street and number}{postcode city}{country}
你將擁有一個國家。否則,像這樣:
\address{street and number}{postcode city}
你將沒有國家(如我上一張照片所示)。
完整的MWE
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\makeatletter
\patchcmd{\makecvtitle}{@{}r@{}}{@{}l@{}}{}{}
\patchcmd{\makecvtitle}{\makenewline\addresssymbol\@addressstreet}{\addresssymbol\@addressstreet\makenewline}{}{}
\patchcmd{\makecvtitle}{\makenewline\@extrainfo}{}{}{}
\patchcmd{\makecvtitle}{\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}{\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}\makenewline\@extrainfo}{}{}
\makeatother
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}