moderncv 클래스: 주소 섹션을 왼쪽 정렬한 후 들여쓰기 방지

moderncv 클래스: 주소 섹션을 왼쪽 정렬한 후 들여쓰기 방지

나는 moderncv 클래스를 사용하고 있습니다(http://www.ctan.org/pkg/moderncv) 이력서를 작성합니다. 주소 부분을 수정하기 위해 moderncvstyleclassic.sty를 수정했습니다.

주소 섹션의 텍스트를 왼쪽 정렬(작동)하고 싶지만 이제 주소(addressstreet)의 첫 번째 줄이 들여쓰기되는 문제가 있습니다.

내 질문은: 이 정보 상자 내에서 첫 번째 줄의 들여쓰기를 방지하려면 어떻게 해야 합니까?

지금까지 이 문제에 대한 해결책을 찾지 못했습니다.

코드 입력모던cvstyleclassic.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

또한 도시 아래에 추가 정보를 넣으려면 이전 명령 대신 다음 명령 세트를 사용하십시오.

\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}

관련 정보