如何修改 LaTeX 命令,使公司/大学名称居中,并使位置与简历标题中的列长度无关?

如何修改 LaTeX 命令,使公司/大学名称居中,并使位置与简历标题中的列长度无关?

我有这两个用于简历标题的命令,但它并没有给我想要的外观

\documentclass[letterpaper,11pt]{article}

\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\input{glyphtounicode}

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.7in}
\addtolength{\textheight}{1.0in}

\urlstyle{same}

\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
  \vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]

% Ensure that generate pdf is machine readable/ATS parsable
\pdfgentounicode=1

%-------------------------
% Custom commands
\newcommand{\resumeItem}[2]{
  \item\small{
    \textbf{#1}{: #2 \vspace{-2pt}}
  }
}




\newcommand{\resumeSubheading}[4]{
  \vspace{-1pt}\item
    \begin{tabular*}
    {0.97\textwidth}[t]{p{5.8cm}@{\extracolsep{\fill}}l@{}r@{\extracolsep{4mm}}r}
      \textit{\large #3} & \textbf{\underline{#1}} & \textit{\small#2} &  \textit{\small #4}
    \end{tabular*}\vspace{-5pt}
}

\newcommand{\resumeSubheadingEdu}[4]{
  \vspace{-2pt}\item
    \begin{tabular*}
    {0.97\textwidth}[t]{p{5.8cm}@{\extracolsep{\fill}}l@{}r@{\extracolsep{4mm}}r}
      \textit{\large #3} & \textbf{\large\underline{#1}} & \textit{\small#2} &  \textit{\small #4}
    \end{tabular*}\vspace{-6pt}
}


\newcommand{\resumeSubItem}[2]{\resumeItem{#1}{#2}\vspace{-4pt}}

\renewcommand{\labelitemii}{$\circ$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=*]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}

%-------------------------------------------
%%%%%%  CV STARTS HERE  %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\footskip}{4.08003pt}
\begin{document}
\begin{center}

  {\href{https://www.linkedin.com/in/john-doe/}{\huge {\textsc{John Doe}}}}
\end{center}
\begin{center}
    \textbullet \ Toronto, ON
    \textbullet \ \href{mailto:[email protected]}{[email protected]} 
    \textbullet \ 333-222-4444 
{LinkedIn}   
\end{center}
\vspace{-10pt}

\section{\textbf{Professional experience}}
  \resumeSubHeadingListStart
    \resumeSubheading
      {Company 1}{United States}
      {Senior Software Developer}{12/2022 - 12/2023}
      \resumeItemListStart
        \item {item 1},
      \resumeItemListEnd

    

    \resumeSubheading
      {Company4}{Germany}
      { Full Stack Developer}{07/2020 - 07/2021}
      \resumeItemListStart
        \item item1
      \resumeItemListEnd
      
  

    \resumeSubheading{Company6}{Netherlands}{Front-end Developer (part-time)}{Sep 2015 - Sep 2017}
    \resumeItemListStart
        \item {item1}
    \resumeItemListEnd
  \resumeSubHeadingListEnd

\section{Education}
  \resumeSubHeadingListStart
    \resumeSubheadingEdu{University of Florida}{USA, FL}{M.Sc. Computer Engineering}{}
  \resumeSubHeadingListEnd

\end{document}

这是一个示例输出,但我希望公司名称(或大学名称)居中,并且它们的位置与第一列的长度无关,第一列中的文本不会太长,不会超过“高级软件开发人员”,我该如何修改这些命令以获得我想要的输出?或者更好的是,如何只使用一个命令来实现类似的结果?

谢谢! 在此处输入图片描述

答案1

您可以使用命令\rlap\clap\llap将项目的左侧、中间和右侧折叠至零宽度,然后使用\hfill居中。如果任何部分太长,它将与相邻部分重叠。

请注意命令定义和命令参数中的空格,因为它们可能会显示在排版文本中。

\newcommand{\resumeSubheading}[4]{%
  \vspace{-1pt}\item
  \mbox{}%
  \rlap{\itshape\large#3}%
  \hfill
  \clap{\bfseries\underline{#1}}%
  \hfill
  \llap{\itshape\small#2 #4\unskip}%
  \vspace{-5pt}%
}

\newcommand{\resumeSubheadingEdu}[4]{%
  \vspace{-2pt}\item
  \mbox{}%
  \rlap{\itshape\large#3}%
  \hfill
  \clap{\large\underline{#1}}%
  \hfill
  \llap{\itshape\small#2 #4\unskip}%
  \vspace{-6pt}%
}

在此处输入图片描述

\documentclass[letterpaper,11pt]{article}

\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\input{glyphtounicode}

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.7in}
\addtolength{\textheight}{1.0in}

\urlstyle{same}

\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
  \vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]

% Ensure that generate pdf is machine readable/ATS parsable
\pdfgentounicode=1

%-------------------------
% Custom commands
\newcommand{\resumeItem}[2]{
  \item\small{
    \textbf{#1}{: #2 \vspace{-2pt}}
  }
}




\newcommand{\resumeSubheading}[4]{%
  \vspace{-1pt}\item
  \mbox{}%
  \rlap{\itshape\large#3}%
  \hfill
  \clap{\bfseries\underline{#1}}%
  \hfill
  \llap{\itshape\small#2 #4\unskip}%
  \vspace{-5pt}%
}

\newcommand{\resumeSubheadingEdu}[4]{%
  \vspace{-2pt}\item
  \mbox{}%
  \rlap{\itshape\large#3}%
  \hfill
  \clap{\large\underline{#1}}%
  \hfill
  \llap{\itshape\small#2 #4\unskip}%
  \vspace{-6pt}%
}


\newcommand{\resumeSubItem}[2]{\resumeItem{#1}{#2}\vspace{-4pt}}

\renewcommand{\labelitemii}{$\circ$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=*]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}

%-------------------------------------------
%%%%%%  CV STARTS HERE  %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\footskip}{4.08003pt}
\begin{document}
\begin{center}

  {\href{https://www.linkedin.com/in/john-doe/}{\huge {\textsc{John Doe}}}}
\end{center}
\begin{center}
    \textbullet \ Toronto, ON
    \textbullet \ \href{mailto:[email protected]}{[email protected]} 
    \textbullet \ 333-222-4444 
{LinkedIn}   
\end{center}
\vspace{-10pt}

\section{\textbf{Professional experience}}
  \resumeSubHeadingListStart
    \resumeSubheading
      {Company 1}{United States}
      {Senior Software Developer}{12/2022 - 12/2023}
      \resumeItemListStart
        \item {item 1},
      \resumeItemListEnd

    

    \resumeSubheading
      {Company4}{Germany}
      {Full Stack Developer}{07/2020 - 07/2021}
      \resumeItemListStart
        \item item1
      \resumeItemListEnd
      
  

    \resumeSubheading{Company6}{Netherlands}{Front-end Developer (part-time)}{Sep 2015 - Sep 2017}
    \resumeItemListStart
        \item {item1}
    \resumeItemListEnd
  \resumeSubHeadingListEnd

\section{Education}
  \resumeSubHeadingListStart
    \resumeSubheadingEdu{University of Florida}{USA, FL}{M.Sc. Computer Engineering}{}
  \resumeSubHeadingListEnd

\end{document}

相关内容