Moderncv:如何更改地址和城市之間的分隔符

Moderncv:如何更改地址和城市之間的分隔符

我想知道如何更改moderncv主題中地址和城市之間的分隔符\moderncvtheme[blue]{casual},您可以在下圖中看到。我知道可以修改項目符號,\footersymbol但這不會影響上面的連字號。而且到目前為止我還沒有找到解決方案。我希望將連字號替換為項目符號。請有人幫忙。

在此輸入影像描述

\documentclass[12pt,a4paper,sans]{moderncv}

\moderncvtheme[blue]{casual}

\usepackage[ngerman]{babel}

\usepackage[T1]{fontenc}

\name{John}{Doe}
\title{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]}


\begin{document}

\maketitle

\section{test}

\end{document}

編輯1:

我修改了 Torbjørn T. 的建議,得到了以下結果:

在此輸入影像描述

[~\textbullet~]透過[\footersymbol]調整第一行和後續行中項目符號之間的不同間距來替換。同時,我可以透過 全域修改項目符號顏色\renewcommand*{\footersymbol}{{~~~{\rmfamily\textcolor{color1}{\textbullet}}~~~}}。到目前為止,這正是我想要的,甚至更多;)。感謝您的幫助 :)

\documentclass[12pt,a4paper,sans]{moderncv}

\moderncvtheme[blue]{casual}

\usepackage[ngerman]{babel}

\usepackage[T1]{fontenc}

\name{John}{Doe}
\title{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]}

\renewcommand*{\footersymbol}{{~~~{\rmfamily\textcolor{color1}{\textbullet}}~~~}}

\makeatletter
\renewcommand*{\makecvfooter}{%
  \setlength{\footerwidth}{0.8\textwidth}%
  \fancypagestyle{plain}{%
    \fancyfoot[c]{%
      \parbox[b]{\footerwidth}{%
        \centering%
        \color{color2}\addressfont%
        \vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
        \ifthenelse{\isundefined{\@addressstreet}}{}{\addtofooter[]{\addresssymbol\@addressstreet}%
          \ifthenelse{\equal{\@addresscity}{}}{}{\addtofooter[\footersymbol]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
          \ifthenelse{\equal{\@addresscountry}{}}{}{\addtofooter[\footersymbol]{\@addresscountry}}%
          \flushfooter\@firstfooterelementtrue\\}%
        \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
          \addtofooter{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
        \ifthenelse{\isundefined{\@email}}{}{\addtofooter{\emailsymbol\emaillink{\@email}}}%
        \ifthenelse{\isundefined{\@homepage}}{}{\addtofooter{\homepagesymbol\httplink{\@homepage}}}%
        \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
          \addtofooter{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
        \ifthenelse{\isundefined{\@extrainfo}}{}{\addtofooter{\@extrainfo}}%
        \ifthenelse{\lengthtest{\footerboxwidth=0pt}}{}{\flushfooter}% the lengthtest is required to avoid flushing an empty footer, which could cause a blank line due to the \\ after the address, if no other personal info is used
        }}}%
  \pagestyle{plain}}

\makeatother

\begin{document}

\maketitle

\section{test}

\end{document}

答案1

破折號似乎是在\makecvfooter巨集中「硬編碼」的。下面我在兩個地方複製了該巨集的定義moderncvstylecasual.sty並更改~--~為。~\textbullet~

在此輸入影像描述

\documentclass[12pt,a4paper,sans]{moderncv}

\moderncvtheme[blue]{casual}

\usepackage[ngerman]{babel}

\usepackage[T1]{fontenc}

\name{John}{Doe}
\title{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]}


\makeatletter
\renewcommand*{\makecvfooter}{%
  \setlength{\footerwidth}{0.8\textwidth}%
  \fancypagestyle{plain}{%
    \fancyfoot[c]{%
      \parbox[b]{\footerwidth}{%
        \centering%
        \color{color2}\addressfont%
        \vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
        \ifthenelse{\isundefined{\@addressstreet}}{}{\addtofooter[]{\addresssymbol\@addressstreet}%
          \ifthenelse{\equal{\@addresscity}{}}{}{\addtofooter[~\textbullet~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
          \ifthenelse{\equal{\@addresscountry}{}}{}{\addtofooter[~\textbullet~]{\@addresscountry}}%
          \flushfooter\@firstfooterelementtrue\\}%
        \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
          \addtofooter{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
        \ifthenelse{\isundefined{\@email}}{}{\addtofooter{\emailsymbol\emaillink{\@email}}}%
        \ifthenelse{\isundefined{\@homepage}}{}{\addtofooter{\homepagesymbol\httplink{\@homepage}}}%
        \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
          \addtofooter{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
        \ifthenelse{\isundefined{\@extrainfo}}{}{\addtofooter{\@extrainfo}}%
        \ifthenelse{\lengthtest{\footerboxwidth=0pt}}{}{\flushfooter}% the lengthtest is required to avoid flushing an empty footer, which could cause a blank line due to the \\ after the address, if no other personal info is used
        }}}%
  \pagestyle{plain}}

\makeatother


\begin{document}

\maketitle

\section{test}

\end{document}

相關內容