如何使 res.cls 中的名称居中,地址位于两侧

如何使 res.cls 中的名称居中,地址位于两侧

我在这里使用简历模板:http://www.rpi.edu/dept/arc/training/latex/resumes/res9b.tex

类别: http://www.rpi.edu/dept/arc/training/latex/resumes/res.cls

我想知道如何让名称居中,地址在两边,但我不知道如何使用这个 cls 文档,它似乎有办法做到这一点,但我仍然想不通。有什么建议吗?这是我在 cls 中找到的代码。

% prints a centered name with the address centered
% or the two address on opposite sides of the page
%
\def\@printcentername{\begingroup
  % print the name centered
  \leavevmode\hbox to \textwidth{\hfil\@tablebox{\namefont\@name}\hfil}\par
  \@ifundefined{@addressone}{%
    % do nothing
  }{%
    \@ifundefined{@addresstwo}{
      % only one address
      \leavevmode\hbox to \textwidth{\hfil\@tablebox{\@addressone}\hfil}\par
    }{
      % two addresses
      \leavevmode\hbox to \textwidth{\@tablebox{\@addressone}\hfil
                     \@tablebox{\@addresstwo}}\par
    }%
  }%
\endgroup}

我刚刚还找到了这个代码,但如何使用它对我来说仍然是个谜。我想要选项 1:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HEADINGS:
% There are two types of headings:
% 1) one with the name centered and the address centered or
%    in the left and right side if there are two address
% 2) one where the name is in the upper left corner 
%    the a line accross the paper
%    then the address all on one line in the right corner
%    the second address will be directly below the first if defined
%
\let\print@name\relax
\def\ds@centered{\ifx\print@name\relax\let\print@name\@printcentername\fi}
\def\ds@line{\ifx\print@name\relax\let\print@name\@linename\fi}

答案1

您可以通过启用centered文档上的选项来执行此操作:

\documentclass[margin,centered]{resume}

这会将您的姓名置于一行的中央,并使用接下来几行的两侧作为您的地址。

如果您希望您的姓名位于两个地址的同一行,您可以修改该printcentername方法:

\def\@printcentername{\begingroup
  % print the name centered
  %\leavevmode\hbox to \textwidth{\hfil\@tablebox{\namefont\@name}\hfil}\par
  \@ifundefined{@addressone}{%
    % do nothing
  }{%
    \@ifundefined{@addresstwo}{
      % only one address
      \leavevmode\hbox to \textwidth{\hfil\@tablebox{\@addressone}\hfil}\par
    }{
      % two addresses
      \leavevmode\hbox to \textwidth{\@tablebox{\@addressone}\hfil
                     \@tablebox{\namefont\@name}\hfil % Center name in between addresses
                     \@tablebox{\@addresstwo}}\par
    }%
  }%
\endgroup}

相关内容