在 altacv.cls 中 \makecvheader 命令的 \personalinfo 字段的 \location 参数中换行

在 altacv.cls 中 \makecvheader 命令的 \personalinfo 字段的 \location 参数中换行

我正在写简历,我想使用 \makecvheader 命令中的 \location 字段添加地址。但是我的位置信息太大,超出了页面范围。我有很多未使用的空间(见红色区域),我想用它将 \location 信息分成 2-3 行,但 \locationsymbol 只出现一次,可能垂直居中,位于位置信息高度旁边。

希望在 LinkedIn 个人资料链接前显示多行地址

我搜索了一下,但没能轻易找到类似的已回答问题。非常感谢您的帮助。

我附加了 MWE 和我修改过的类文件代码。你能帮我实现这个吗?

这是 MWE。注意:请在您的电脑上添加任意照片以使 MWE 正常工作。

\documentclass[10pt,a4paper,ragged2e]{altacv}

\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm}


\ifxetexorluatex
  % If using xelatex or lualatex:
  \setmainfont{Carlito}
\else
  % If using pdflatex:
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage[default]{lato}
  \usepackage{amsmath}
%  \usepackage{fontawesome}
  \usepackage{fontawesome5}
  \usepackage{xfrac}
  \usepackage{hyperref}
  \hypersetup{hidelinks}
\fi

% Choose the color from here: https://www.webfx.com/web-design/color-picker/
% Change the colours if you want to
%\definecolor{VividPurple}{HTML}{3E0097}
\definecolor{myColor}{HTML}{1E4B7A}
\definecolor{myColor2}{HTML}{0E56A0}
\definecolor{SlateGrey}{HTML}{2E2E2E}
\definecolor{LightGrey}{HTML}{666666}
%\colorlet{heading}{VividPurple}
%\colorlet{accent}{VividPurple}
\colorlet{heading}{myColor}
\colorlet{accent}{myColor}
\colorlet{emphasis}{SlateGrey}
\colorlet{body}{black!70}

% Change the bullets for itemize and rating marker
% for \cvskill if you want to
\renewcommand{\itemmarker}{{\small\textbullet}}
\renewcommand{\ratingmarker}{\faCircle}

% control spacing between icon and heading
\newcommand{\myspace}{\hspace{0.1cm}}

\begin{document}
\name{John \myspace Doe \myspace \faMale}

\tagline{Product \& Innovation Specialist}
\photo{3.5cm}{pictures/briangriffin}
\personalinfo{
  \dob{01.01.2024}\hspace{2cm}
  \nationality{Germany}
  \email{\href{mailto:[email protected]}{[email protected]}}
  \phone{+49 123456789 \faWhatsapp}
  \location{Want to enter address here which spans multiple lines and leaves page}
%  \skype{vadvait}
  \linkedin{\href{https://www.linkedin.com/}{\textcolor{myColor2}{LinkedIn Profile}}}
}

%% Make the header extend all the way to the right, if you want.
\begin{fullwidth}
\makecvheader
\end{fullwidth}

%% Depending on your tastes, you may want to make fonts of itemize environments slightly smaller
\AtBeginEnvironment{itemize}{\normalsize}
\begin{fullwidth}
    \cvsection{\faUser \myspace Background}
        
    \cvsection{\faBriefcase \myspace Work Experience}
    \cvevent{Senior Solution Specialist}{Good Company}{August 2022 - current}{Berlin, DEU}
    \begin{itemize}     
        \item Demonstrated an in-depth understanding of customer processes and tool workflows by supporting over 50 qualification activities across various autonomy sector clients, leveraging extensive product knowledge and industry experience.
    \end{itemize}

    \divider
    
    \cvevent{Lead Module Product Manager}{Great Company LLC}{April 2021 -- June 2022}{New York, USA}
    \begin{itemize}
        
        \item Directed the approval process for cross-vehicle nameplate modules, managing an annual budget of approximately €100 million with precision using project and product management methodologies. Prioritized adherence to governmental regulations while fostering innovation tailored to diverse markets.
        
        
    \end{itemize}
    

%\newpage
\end{fullwidth}
    \cvsection{\faGraduationCap \myspace Education}
    
    \cvevent{M.\,Sc.\  Automotive Engineering}{Vanderbilt University}{Oct. 2011 -- May 2014}{Aachen, DEU}
    
    \divider
    
    \cvevent{B.\,E.\  Mechanical Engineering}{MIT}{Sep. 2007 -- May 2011}{Hyderabad, IND}
    
    
\cvsection{\faTrophy \myspace Achievements}
\begin{itemize}
    \item Rubik's cube genius
\end{itemize}
    

\vfill
\textbf{John Doe}\\
\today
%Ingolstadt, June 2022}


\end{document}

这是我正在使用的 .cls 文件。

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%% v1.4: Detect TL2018 to handle accented characters in class information
\@ifl@t@r\fmtversion{2018/04/01}{\UseRawInputEncoding}{}
\ProvidesClass{altacv}[2018/12/01 AltaCV v1.1.5, yet another alternative class for a résumé/curriculum vitae.]

%% v1.1: Optionally load academicons
\newif\if@academicons
\DeclareOption{academicons}{\@academiconstrue}
%% v1.1.3: Choice of round/square photo
\newif\if@normalphoto
\DeclareOption{normalphoto}{\@normalphototrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\newif\if@raggedtwoe
\DeclareOption{ragged2e}{\@raggedtwoetrue}
\ProcessOptions\relax

\LoadClass{extarticle}

\RequirePackage[margin=2cm]{geometry}
%\RequirePackage{fontawesome}
\RequirePackage{fontawesome5}
\RequirePackage{ifxetex,ifluatex}
\RequirePackage{scrlfile}

%% v1.1.5: added for convenience
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi

%% v1.1: Optionally load academicons
%% v1.1.5: Handle different versions of academicons
\if@academicons
  \ifxetexorluatex
    \RequirePackage{fontspec}
    %% academicons in TL2018 doesn't require
    %% Academicons to be installed in OS fonts
    %% so can be loaded directly
    \@ifl@t@r\fmtversion{2018/04/01}{%
      \RequirePackage{academicons}
    }{%
      % TL2017
      \@ifl@t@r\fmtversion{2017/04/01}{%
        \@ifpackagelater{academicons}{2018/03/01}{%
          \RequirePackage{academicons}
        }{%
          \let\ori@newfontfamily\newfontfamily%
          \renewcommand{\newfontfamily}[2]{}
          \RequirePackage{academicons}
          \let\newfontfamily\ori@newfontfamily
          \newfontfamily{\AI}{academicons.ttf}
        }
      }{% TL2016 requires the package to be loaded before
        % the version can be checked. Only added because
        % Overleaf v1 still runs TL2016; will be removed
        % when v1 is completely retired.
          \let\ori@newfontfamily\newfontfamily%
          \renewcommand{\newfontfamily}[2]{}
          \RequirePackage{academicons}
          \let\newfontfamily\ori@newfontfamily
          \newfontfamily{\AI}{academicons.ttf}
      }
    }
  \else
    \ClassError{AltaCV}{academicons unsupported by latex or pdflatex. Please compile with xelatex or lualatex}{Please compile with xelatex or lualatex to use the academicons option}
  \fi
\fi

\if@raggedtwoe
  \RequirePackage[newcommands]{ragged2e}
\fi

\RequirePackage{xcolor}

\colorlet{accent}{blue!70!black}
\colorlet{heading}{black}
\colorlet{emphasis}{black}
\colorlet{body}{black!80!white}
\newcommand{\itemmarker}{{\small\textbullet}}
\newcommand{\ratingmarker}{\faCircle}

\RequirePackage{tikz}
\usetikzlibrary{arrows}
\RequirePackage[skins]{tcolorbox}
\RequirePackage{enumitem}
\setlist{leftmargin=*,labelsep=0.5em,nosep,itemsep=0.25\baselineskip,after=\vskip0.25\baselineskip}
\setlist[itemize]{label=\itemmarker}
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{dashrule}
\RequirePackage{multirow,tabularx}
\RequirePackage{changepage}
% \RequirePackage{marginfix}
\RequirePackage{hyperref}

\setlength{\parindent}{0pt}
\newcommand{\divider}{\textcolor{body!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}

\newenvironment{fullwidth}{%
  \begin{adjustwidth}{}{\dimexpr-\marginparwidth-\marginparsep\relax}}
  {\end{adjustwidth}}

\newcommand{\emailsymbol}{\faEnvelope}
\newcommand{\phonesymbol}{\faPhone}
\newcommand{\homepagesymbol}{\faChain}
\newcommand{\locationsymbol}{\faMapMarker}
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\twittersymbol}{\faTwitter}
\newcommand{\githubsymbol}{\faGithub}
\newcommand{\orcidsymbol}{\aiOrcid}
\newcommand{\mailsymbol}{\faEnvelope}
\newcommand{\xingsymbol}{\faXing}
\newcommand{\facebooksymbol}{\faFacebook}
\newcommand{\skypesymbol}{\faSkype}
\newcommand{\calendarsymbol}{\faCalendar}
\newcommand{\flagsymbol}{\faFlag}

\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}

\newcommand{\name}[1]{\def\@name{#1}}
\newcommand{\persinfo}[1]{\def\@persinfo{#1}}
\newcommand{\dob}[1]{\printinfo{\calendarsymbol}{#1}}
\newcommand{\nationality}[1]{\printinfo{\flagsymbol}{#1}}
\newcommand{\tagline}[1]{\def\@tagline{#1}}
\newcommand{\photo}[2]{\def\@photo{#2}\def\@photodiameter{#1}}
\newcommand{\email}[1]{\printinfo{\emailsymbol}{#1}}
\newcommand{\mailaddress}[1]{\printinfo{\mailsymbol}{#1}}
\newcommand{\phone}[1]{\printinfo{\phonesymbol}{#1}}
\newcommand{\homepage}[1]{\printinfo{\homepagesymbol}{#1}}
\newcommand{\twitter}[1]{\printinfo{\twittersymbol}{#1}}
\newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{#1}}
%\newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{\href[Profile]{''#1''}}}
\newcommand{\github}[1]{\printinfo{\githubsymbol}{#1}}
\newcommand{\orcid}[1]{\printinfo{\orcidsymbol}{#1}}
\newcommand{\location}[1]{\printinfo{\locationsymbol}{#1}}
\newcommand{\xing}[1]{\printinfo{\xingsymbol}{#1}}
\newcommand{\facebook}[1]{\printinfo{\facebooksymbol}{#1}}
\newcommand{\skype}[1]{\printinfo{\skypesymbol}{#1}}

\newcommand{\personalinfo}[1]{\def\@personalinfo{#1}}

% picture to the left, personal info to the right

\newcommand{\makecvheader}{
 \begingroup
    \begin{minipage}{\@photodiameter}
    \if@normalphoto
      \includegraphics[width=\linewidth]{\@photo}
    \else
      \tikz\path[fill zoom image={\@photo}]circle[radius=0.5\linewidth];
    \fi%
    \end{minipage}\hfill%
    \ifdef{\@photodiameter}{\begin{minipage}{\dimexpr\linewidth-\@photodiameter-2em}}{}%
    {\begin{minipage}{\dimexpr.58\linewidth}%
    \raggedright\color{emphasis}%
    {\huge\bfseries\MakeUppercase{\@name}\par}
    %\smallskip
    %{\normalsize{\@persinfo}\par}
    \medskip
    {\Large\bfseries\color{accent}\@tagline\par}
    \end{minipage}}
    \hfill
    \begin{minipage}{\dimexpr.4\linewidth}{%
    {\normalsize\bfseries\@personalinfo\par}}
    \end{minipage}\par
    \ifdef{\@photodiameter}{%
    \end{minipage}\par}{}%
  \endgroup\medskip
}


\renewenvironment{quote}{\color{accent}\itshape\large}{\par}

\newcommand{\grade}[1]{%
  \begin{tikzpicture}
    \clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=body!30}] (\x em,0) circle (.35em); % backColor
    }
    \begin{scope}
    \clip (1em-.4em,-.35em) rectangle (#1em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=accent}] (\x em,0) circle (.35em); % frontColor
    }
    \end{scope}
  \end{tikzpicture}%
}

\newcommand{\cvsection}[2][]{%
  \bigskip%
  \ifstrequal{#1}{}{}{\marginpar{\vspace*{\dimexpr1pt-\baselineskip}\raggedright\input{#1}}}%
  {\color{heading}\large\bfseries\MakeUppercase{#2}}\\[-1ex]%
  {\color{heading}\rule{\linewidth}{2pt}\par}\medskip
}

\newcommand{\cvsubsection}[1]{%
  \smallskip%
  {\color{emphasis}\large\bfseries{#1}\par}\medskip
}

% v1.1.4: fixes inconsistent font size
\newcommand{\cvevent}[4]{%
  {\large\color{emphasis}#1\par}
  \smallskip\normalsize
  \ifstrequal{#2}{}{}{
  \textbf{\color{accent}#2}\par
  \smallskip}
  \ifstrequal{#3}{}{}{{\small\makebox[0.5\linewidth][l]{\faCalendar\hspace{0.5em}#3}}}%
  \ifstrequal{#4}{}{}{{\small\makebox[0.5\linewidth][l]{\faMapMarker\hspace{0.5em}#4}}}\par
  \medskip\normalsize
}

\newcommand{\cvachievement}[3]{%
  \begin{tabularx}{\linewidth}{@{}p{2em} @{\hspace{1ex}} >{\raggedright\arraybackslash}X@{}}
  \multirow{2}{*}{\Large\color{accent}#1} & \bfseries\textcolor{emphasis}{#2}\\
  & #3
  \end{tabularx}%
  \smallskip
}

\newcommand{\cvtag}[1]{%
  \tikz[baseline]\node[anchor=base,draw=body!30,rounded corners,inner xsep=1ex,inner ysep =0.75ex,text height=1.5ex,text depth=.25ex]{#1};
}


\newcommand{\cvskill}[2]{%
  \textcolor{emphasis}{\textbf{#1}}\hfill
  \grade{#2}\par
}

% Adapted from @Jake's answer at http://tex.stackexchange.com/a/82729/226
\newcommand{\wheelchart}[4][0]{%
    \begingroup\centering
    \def\innerradius{#3}%
    \def\outerradius{#2}%
    % Calculate total
    \pgfmathsetmacro{\totalnum}{0}%
    \foreach \value/\colour/\name in {#4} {%
        \pgfmathparse{\value+\totalnum}%
        \global\let\totalnum=\pgfmathresult%
    }%
    \begin{tikzpicture}

      % Calculate the thickness and the middle line of the wheel
      \pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
      \pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}
      \pgfmathsetmacro{\totalrot}{-90 + #1}

      % Rotate so we start from the top
      \begin{scope}[rotate=\totalrot]

      % Loop through each value set. \cumnum keeps track of where we are in the wheel
      \pgfmathsetmacro{\cumnum}{0}
      \foreach \value/\width/\colour/\name in {#4} {
            \pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}

            % Calculate the percent value
            \pgfmathsetmacro{\percentage}{\value/\totalnum*100}
            % Calculate the mid angle of the colour segments to place the labels
            \pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}

            % This is necessary for the labels to align nicely
            \pgfmathparse{
               (-\midangle>180?"west":"east")
            } \edef\textanchor{\pgfmathresult}
            \pgfmathparse{
               (-\midangle>180?"flush left":"flush right")
            } \edef\textalign{\pgfmathresult}
            \pgfmathsetmacro\labelshiftdir{1-2*(-\midangle<180)}

            % Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
            \filldraw[draw=white,fill=\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
            (-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;

            % Draw the data labels
            \draw  [*-,thin,emphasis] node [append after command={(\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [xshift=\labelshiftdir*0.5cm,inner sep=1ex, outer sep=0pt, text width=\width,anchor=\textanchor,align=\textalign,font=\small,text=body]{\name};
            % Set the old cumulated angle to the new value
            \global\let\cumnum=\newcumnum
        }
      \end{scope}
%      \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
    \end{tikzpicture}\par
    \endgroup
}

\newcommand{\cvref}[3]{%
  \smallskip
  \textcolor{emphasis}{\textbf{#1}}\par
  \begin{description}[font=\color{accent},style=multiline,leftmargin=1.35em]
  \item[\normalfont\emailsymbol] #2
  \item[\small\normalfont\mailsymbol] #3
  \end{description}
%   \medskip
}

\newenvironment{cvcolumn}[1]{\begin{minipage}[t]{#1}\raggedright}{\end{minipage}}

\RequirePackage[backend=biber,style=authoryear,sorting=ydnt]{biblatex}
%% For removing numbering entirely when using a numeric style
% \setlength{\bibhang}{1em}
% \DeclareFieldFormat{labelnumberwidth}{\makebox[\bibhang][l]{\itemmarker}}
% \setlength{\biblabelsep}{0pt}
\defbibheading{pubtype}{\cvsubsection{#1}}
\renewcommand{\bibsetup}{\vspace*{-\baselineskip}}
\AtEveryBibitem{\makebox[\bibhang][l]{\itemmarker}}
\setlength{\bibitemsep}{0.25\baselineskip}

% v1.1.2: make it easier to add a sidebar aligned with top of next page
\RequirePackage{afterpage}
\newcommand{\addsidebar}[2][]{\marginpar{%
  \ifstrequal{#1}{}{}{\vspace*{#1}}%
  \input{#2}}%
}
\newcommand{\addnextpagesidebar}[2][]{\afterpage{\addsidebar[#1]{#2}}}

\AtBeginDocument{%
  \pagestyle{empty}
  \color{body}
  \raggedright
}

答案1

您可以使用允许换行的环境重新实现\printinfo(类中的第 124 行) 。itemize

由于该enumitem包已被类加载,因此您可以使用该包的一些设置来使图标居中并减少行距,类似于itemize - 自定义项目符号的对齐方式列表中的垂直空间

在课堂里:

\SetLabelAlign{center}{\hss#1\hss}
\newcommand{\printinfo}[2]{\begin{itemize}[leftmargin=20pt,align=center,parsep=-2pt]\item[\textcolor{accent}{\normalfont #1}]#2\end{itemize}}

\renewcommand或者,如果您(或未来的读者)不想修改该类,可以在文档本身中使用:

\documentclass[10pt,a4paper,ragged2e]{altacv}
\SetLabelAlign{center}{\hss#1\hss}
\renewcommand{\printinfo}[2]{\begin{itemize}[leftmargin=20pt,align=center,parsep=-2pt]\item[\textcolor{accent}{\normalfont #1}]#2\end{itemize}}

\\设置换行符的信息:

\personalinfo{
  \dob{01.01.2024}\hspace{2cm}
  \nationality{Germany}
  \email{\href{mailto:[email protected]}{[email protected]}}
  \phone{+49 123456789 \faWhatsapp}
  \location{Want to enter address here\\which spans multiple lines\\and leaves page}
%  \skype{vadvait}
  \linkedin{\href{https://www.linkedin.com/}{\textcolor{myColor2}{LinkedIn Profile}}}
}

结果:

在此处输入图片描述

相关内容