Friggeri CV 模板部分中的文本对齐

Friggeri CV 模板部分中的文本对齐

我在联系人部分的文本对齐方面遇到了问题Friggeri 简历模板。我希望长电子邮件地址或网站名称能够正确对齐向右就像“联系人”部分下的其他内容一样。您对如何完成此操作有什么建议吗?

我尝试更改geometry包中的参数ragged2e并修改环境,但没有任何效果。这是使用的asidecv-style

% -- Encoding UTF-8 without BOM

\ProvidesClass{cv-style}[2015/02/27 CV class]
\NeedsTeXFormat{LaTeX2e}

\DeclareOption{espanol}{\def\@cv@espanol{}}
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
  \PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
\LoadClass{article}

%----------------------------------------------------------------------------------------
% Colors %
%----------------------------------------------------------------------------------------

\RequirePackage{xcolor}

\definecolor{white}{RGB}{255,255,255}

\definecolor{darkgray}{HTML}{333333}
\definecolor{gray}{HTML}{4D4D4D}
\definecolor{lightgray}{HTML}{999999}

\definecolor{blue}{HTML}{66D9EE}
\definecolor{red}{HTML}{FA2772}
\definecolor{orange}{HTML}{FE9720}
\definecolor{green}{HTML}{A7E22E}
\definecolor{purple}{HTML}{9358FE}
\definecolor{aquamarine}{HTML}{36AF90}

\definecolor{date}{HTML}{A4A4A4}

\ifdefined\@cv@print
  \colorlet{blue}{gray}
  \colorlet{red}{gray}
  \colorlet{orange}{gray}
  \colorlet{green}{gray}
  \colorlet{purple}{gray}
  \colorlet{aquamarine}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi
\colorlet{textcolor}{gray}
\colorlet{headercolor}{gray}

%----------------------------------------------------------------------------------------
% Fonts %
%----------------------------------------------------------------------------------------

\RequirePackage[quiet]{fontspec}
\RequirePackage{unicode-math}

\newfontfamily\bodyfont{Computer 
 Modern}
\newfontfamily\bodyfontit{Computer Modern}
\newfontfamily\thinfont{Computer Modern}
\newfontfamily\headingfont{Computer Modern}

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Computer Modern}

\newcommand{\italica}[1]{%
    {\color{gray}\bodyfontit #1}%
}

%----------------------------------------------------------------------------------------
% Header %
%----------------------------------------------------------------------------------------

\RequirePackage{tikz}

\newcommand{\header}[2]{%
  \begin{tikzpicture}[remember picture,overlay]
    \node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=2cm] (box) at (current page.north){};
    \node [anchor=center] (name) at (box) {%
      \fontsize{40pt}{65pt}\color{header}%
      {\thinfont #1}{\bodyfont  #2}
    };
  \end{tikzpicture}
  \vspace{1cm}
  \vspace{-2\parskip}
}

%----------------------------------------------------------------------------------------
%   Last updated command %
%----------------------------------------------------------------------------------------

\RequirePackage[absolute,overlay]{textpos}
\RequirePackage{polyglossia}

\newcommand{\sethyphenation}[3][]{%
  \sbox0{\begin{otherlanguage}[#1]{#2}
    \hyphenation{#3}\end{otherlanguage}}}
%\sethyphenation[<options>]{<language>}{<list of words separated by spaces>}

\ifdefined\@cv@espanol
  \setdefaultlanguage{spanish}
  \def\lastupdatedtext{Última Actualización el}
\else
  \setdefaultlanguage[variant=british]{english}
  \def\lastupdatedtext{Last Updated on}
\fi

\setlength{\TPHorizModule}{0.01\paperwidth}
\setlength{\TPVertModule}{0.01\paperwidth}

\newcommand{\lastupdated}{ 
  \begin{textblock}{10}(11.3, 0.05)
    \raggedleft
    \fontsize{8pt}{10pt}\color{date}\thinfont 
    \lastupdatedtext{} \today
  \end{textblock}}

%----------------------------------------------------------------------------------------
% Structure %
%----------------------------------------------------------------------------------------
\RequirePackage{parskip}

\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        aquamarine\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

\renewcommand{\section}[1]{
  {\par\vspace{\parskip}
  {%
    \LARGE\headingfont\color{headercolor}%
    \@sectioncolor #1%
  }
  \par\vspace{\parskip}}
}

\renewcommand{\subsection}[2]{
  \par\vspace{.5\parskip}%
  \Large\headingfont\color{headercolor} #2%
  \par\vspace{.25\parskip}%
}

\newcommand{\jobtitle}[1]{%
    {\color{gray}\bodyfontit #1}%
}

\pagestyle{empty}

%----------------------------------------------------------------------------------------
% List environment %
%----------------------------------------------------------------------------------------

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
  \end{tabular*}
}
\renewcommand{\bfseries}{\headingfont\color{headercolor}}
\newcommand{\entry}[4]{%
  #1&\parbox[t]{12.8cm}{%
    \textbf{#2}%
    \hfill%
    {\footnotesize\addfontfeature{Color=lightgray} #3}\\%
    #4\vspace{\parsep}%
  }\\}

%----------------------------------------------------------------------------------------
% Side block %
%----------------------------------------------------------------------------------------


\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}
\newenvironment{aside}{%
  \let\oldsection\section
  \renewcommand{\section}[1]{
    \par\vspace{\baselineskip}{\Large\headingfont\color{headercolor} ##1}
  }
  \begin{textblock}{3.6}(1, 1.87)
  \begin{flushright}
  \obeycr
}{%
  \restorecr
  \end{flushright}
  \end{textblock}
  \let\section\oldsection
}

%----------------------------------------------------------------------------------------
% Other tweaks %
%----------------------------------------------------------------------------------------

\RequirePackage[left=5.6cm,top=1cm,right=1cm,bottom=1cm,nohead,nofoot]{geometry}
\RequirePackage{hyperref}
\hypersetup{
    pdftitle=CV/Resume \textbar{} Alejandro Pérez Londoño,
    pdfauthor=Alejandro Pérez Londoño,
    pdfsubject=CV/Resume%
    }

这是 MWE:

% -- Encoding UTF-8 without BOM
% -- XeLaTeX => PDF (BIBER)
\documentclass{cv-style}
\RequirePackage{unicode-math}


\begin{document}
\header{My}{Name}
\begin{aside}
%
\section{contact}
123 Broadway
City, State 050022
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
[email protected]
mywebsitetoo.wordpress.com
%
\end{aside}
%
\section{skills}
  \vspace{-0.2cm}

Skill 1, skill 2, skill 3, skill 4, skill 5.

\section{education}
\begin{entrylist}
%------------------------------------------------
\entry
{2010--2011}
{M.Sc. {\normalfont in Economics [Grade]}}
{University}
{\vspace{-0.3cm}}
%------------------------------------------------
\entry
{2004--2009}
{B.Eng. {\normalfont in Engineering Management [Grade]}}
{University}
{(Emphasis in ...)}
%------------------------------------------------
\end{entrylist}


\end{document}

输出:

在此处输入图片描述

答案1

正如你在类文件中看到的这一行

\RequirePackage[left=5.6cm,top=1cm,right=1cm,bottom=1cm,nohead,nofoot]{geometry}

左边距只保留了5.6cm,用于添加环境数据aside。对于您的电子邮件地址来说,这太小了。

因此你必须重新定义三件事:

  1. 更大的左边距,例如\geometry{left=7cm}。请注意,我还添加了用于测试目的的选项showframe,以geometry可视化打字区域和边距...
  2. 更正/更改行中的文本长度,aside并将其更改3.65

    \begin{textblock}{5}(1, 1.87) % <=================================== 3.6 -> 5
    
  3. 正确使用的长度12.8cm现在需要10.8cm在命令\entry行中

    #1&\parbox[t]{10.8cm}{% <============================================= 12.8cm --> 10.8cm
    

完整的代码如下

% -- Encoding UTF-8 without BOM
% -- XeLaTeX => PDF (BIBER)
\documentclass{cv-style}

\renewenvironment{aside}{% <============================================
  \let\oldsection\section
  \renewcommand{\section}[1]{
    \par\vspace{\baselineskip}{\Large\headingfont\color{headercolor} ##1}
  }
  \begin{textblock}{5}(1, 1.87) % <=================================== 3.6 -> 5
  \begin{flushright}
  \obeycr
}{%
  \restorecr
  \end{flushright}
  \end{textblock}
  \let\section\oldsection
}

\renewcommand{\entry}[4]{% <============================================
  #1&\parbox[t]{10.8cm}{% <============================================= 12.8cm --> 10.8cm
    \textbf{#2}%
    \hfill%
    {\footnotesize\addfontfeature{Color=lightgray} #3}\\%
    #4\vspace{\parsep}%
  }\\}


\geometry{%
  showframe, % <================ only to visualize typing area & margins
  left=7cm   % <============================= bigger space on right side 5.6cm --> 7cm
}


\begin{document}

\header{My}{Name}
\begin{aside}
%
\section{contact}
123 Broadway
City, State 050022
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
[email protected]
mywebsitetoo.wordpress.com
%
\end{aside}
%
\section{skills}
  \vspace{-0.2cm}

Skill 1, skill 2, skill 3, skill 4, skill 5.

\section{education}
\begin{entrylist}
%------------------------------------------------
\entry
{2010--2011}
{M.Sc. {\normalfont in Economics [Grade]}}
{University}
{\vspace{-0.3cm}}
%------------------------------------------------
\entry
{2004--2009}
{B.Eng. {\normalfont in Engineering Management [Grade]}}
{University}
{(Emphasis in ...)}
%------------------------------------------------
\end{entrylist}


\end{document}

你得到了想要的结果:

生成的 pdf

顺便说一句:模板不是很好,所有你必须手动更改的长度都应该计算出来,而不是用作固定值...可能你必须更改更多数字...

相关内容