左对齐或右对齐标题

左对齐或右对齐标题

如果我想将联系信息在(右)标题块中左对齐。如何对齐标题中的内容?

包裹:

\ProvidesFile{jobapp}
\special{papersize=8.5in,11in}

%----------------------------------------------
%   Dependencies 
%----------------------------------------------
\usepackage{array}
\usepackage{xcolor}
\usepackage[margin=1.5cm,top=50pt]{geometry}
\usepackage{parskip}
\usepackage{setspace}
\usepackage{tgpagella} % TG Pagella font
\usepackage{textcomp} % Needed for pagella font bullet points
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{ifthen}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage{xparse}

%----------------------------------------------
%   Debugging utilities (uncomment to enable)
%----------------------------------------------
%\overfullrule=1mm % Show overfull hboxes
%\usepackage{layout} % Insert graphic of page layout using \layout in body

%----------------------------------------------
%   Custom things
%----------------------------------------------
\definecolor{lightgray}{gray}{0.8}
\newcommand\VRule{\color{lightgray}\vrule width 1pt}
\newcommand\HRule{\color{lightgray}\hrule height 0.4pt} 
\newcolumntype{L}{>{\raggedleft}p{0.11\textwidth}}
\newcolumntype{R}{p{0.83\textwidth}}

\makeatletter
\newcommand{\DoIfNoText}[1]{% Thanks to http://tex.stackexchange.com/a/44938
  \begingroup
  \sbox0{#1}%
  \ifdim\wd0=\z@
    \endgroup
    \expandafter\@gobble
  \else
    \endgroup
    \expandafter\@firstofone
  \fi}
\makeatother

%----------------------------------------------
%   Document Variables
%----------------------------------------------
\newcommand\Name{}
\newcommand\Address{}
\newcommand\Phone{}
\newcommand\Email{}
\newcommand\Company{}
\newcommand\CompanyAddress{}
\newcommand\Encl{}
\newcommand\Skype{}
%----------------------------------------------
%   Setters
%----------------------------------------------
\newcommand{\SetName}[1]{\renewcommand{\Name}{#1}}
\newcommand{\SetAddress}[1]{\renewcommand{\Address}{#1}}
\newcommand{\SetPhone}[1]{\renewcommand{\Phone}{#1}}
\newcommand{\SetEmail}[1]{\renewcommand{\Email}{#1}}
\newcommand{\SetSkype}[1]{\renewcommand{\Skype}{#1}}

\newcommand{\OptionalCompany}[1]{%
  \DoIfNoText{#1}
    {\renewcommand{\Company}{\ignorespaces#1}}%
  }

\newcommand{\OptionalCompanyAddress}[1]{%
  \DoIfNoText{#1}
    {\renewcommand{\CompanyAddress}{\ignorespaces#1}}%
  }

\newcommand{\OptionalEncl}[1]{%
  \DoIfNoText{#1}
    {\renewcommand{\Encl}{\ignorespaces#1}}%
  }

%----------------------------------------------
%   Helpers
%----------------------------------------------
\newcommand{\emailhref}{\faEnvelope{}~ \href{mailto:\Email}{\Email}}
\newcommand{\contactblock}{\Address \\ \Phone \\ \emailhref \\ \Skype}
\newcommand{\first}{1\textsuperscript{st}}
\newcommand{\second}{2\textsuperscript{nd}}
\newcommand{\third}{3\textsuperscript{rd}}
\newcommand{\nth}[1]{#1\textsuperscript{th}}

%----------------------------------------------
%   Page customizations
%----------------------------------------------
\pagestyle{fancy}
\setlength{\headheight}{56pt}
\setlength{\headsep}{32pt}
\setlength{\textheight}{668pt}
\setlength{\footskip}{10pt}
\setlength{\parskip}{10pt}
\renewcommand{\arraystretch}{1.2}
\renewcommand{\headrule}{\vspace{5pt}\HRule}
\renewcommand{\footrule}{}
\titleformat*{\section}{\bfseries\Large\uppercase}
\titlespacing{\section}
  {0pt} % left
  {5pt} % before
  {-2pt} % after
  [0pt] % right

%----------------------------------------------
%   Header & footer definitions
%----------------------------------------------

%% Header Left - Show large name on first page
\fancyhead[LH]{% 
  \ifthenelse{\value{page}=1}{%
    \raisebox{0.5\height}{\Huge\scshape{\Name}}%
  }{}
}

%% Header Right - Show contact info on first page; name otherwise.
\fancyhead[RH]{% 
  \ifthenelse{\value{page}=1}{%
    \contactblock%
  }{%
    \Large\scshape{\Name}%
  }
}

%% Footer - Empty Footer
\fancyfoot[CF]{}

%----------------------------------------------
%   Macros & other
%----------------------------------------------

%% Table style used by resume including vertical divider
\newenvironment{CvTable}
  {\begin{tabular}{L!{\VRule}R}}
  {\end{tabular}}

%% Formats resume item blocks
\NewDocumentEnvironment
  {CvBlockEnv}
  {m >{\SplitArgument{1}{\\}} m}
  {%
    \begin{CvTable} %
      #1 & \CvBlockSplitTitle#2 % Set year/title/subtitle
  }{%
    \end{CvTable} % End block detail
  }

%% Splits the second argument to CvBlockEnv into Title & Subtitle
\def\CvBlockSplitTitle#1#2{%
  \parbox[t]{0.8\textwidth}{\textbf{#1}%
    \IfValueTF {#2} { \\ \textit{#2} } { }%
  }
}

%% Create compact itemize
\newenvironment{citemize}
  { \vspace{0.2em}\begin{itemize}[leftmargin=12pt, itemsep=0.2em] }
  { \vspace{-1em}\end{itemize} }

%----------------------------------------------
%   Cover Letter
%----------------------------------------------
\newenvironment{CoverLetter}
  {%
    \today \par \vspace{20pt}%
    \DoIfNoText{\CompanyAddress} {%
      \DoIfNoText{\Company}%
        {\Company \\}
      \CompanyAddress \par \vspace{30pt}
    }
  }
  {
    \par 
    %\vspace{0pt}%
    \Name{} \par \vspace{10pt}%
    \DoIfNoText{\Encl} {\par\noindent\textbf{Encl:}~\Encl{}}%
  }

梅威瑟:

    \documentclass[10pt]{article}
\usepackage{jobapp}
\usepackage{amsmath}%symbols
\usepackage{fontawesome} % add skype, FB and Gtalk symbol :)
%\providecommand\faSkype{{\FA\symbol{"F17E}}} % add skype symbol.
\usepackage[export]{adjustbox} % left align the figure
\usepackage{graphicx}%graphicx package
\usepackage{lipsum} % Used only for this example.

%----------------------------------------------
%   Document information
%----------------------------------------------
\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}%0.0,0.0,0.3
\hypersetup{colorlinks,breaklinks,
            linkcolor=darkblue,urlcolor=darkblue,
            anchorcolor=darkblue,citecolor=darkblue}
%------------------------------------------------------------
\usepackage{fontspec} % use package for cambria font
\setmainfont{Cambria} %set font

%------------------------------------------------------------
\SetName{First Last}
\SetAddress{Street name, Apt Number, \\City, St~123455~-~1234,~~~USA} % Address
\SetPhone{\faPhone{}~+1~-~123~-~456~-~7890~} % phone number
\SetEmail{[email protected]}

%----------------------------------------------
%   Document
%----------------------------------------------
\begin{document}
Dear Hiring Manager,

Enter context here.

Closing statement.

Signature (Pic)
Signature (Text)
\end{document}

输出:

输出1

**更新:添加表格我可以实现我需要的,但是**

   \fancyhead[RH]{% 
\scshape
  \ifthenelse{\value{page}=1}{%
    %\contactblock% display elements in contact block.
          \begin{tabular}[t]{@{}l@{}}
              \contactblock
                 \end{tabular}
    }{%
    \Large\scshape{\Name}% Subsequent pages will have your name as the R-Header.
  }
}

更新后的输出使得左标题和右标题不对齐。 2

答案1

将评论转换为答案,只是为了关闭事情,注意它jobapp.sty不包含在 miktex 中(至少)。

使用[b]而不是[t]in \begin{tabular}[t]{@{}l@{}}。这将使First Last(name) 与表格底部对齐。

相关内容