格式和新命令问题

格式和新命令问题

从这里开始我的问题 - 格式化简历标题!

我想通过在方法下添加表格部分来简化代码,所以我尝试了\newcommand

以下是代码

\newcommand\headtitle[4]{
\begin{tabular}{p{\dimexpr\linewidth-2\tabcolsep}}
\textbf{#1} \\
\hline
{\bfseries #2, \hfill #3 \hfill #4} \\
\quad
\end{tabular}

不幸的是,使用这个之后我遇到了对齐问题 - 我不想让代码过于复杂所以我使用了它 -

上面的输入是--

\headtitle{Freelancer Work}{Author}{Linux Journal}{2011}

但如果我之后使用东西 - 它看起来像这样

在此处输入图片描述

我想要像这样的对齐 -

在此处输入图片描述

\hline此外,我想通过分离和标题使其更简单,但删除\hline也会引发错误(从原始代码)

任何意见都是好的:)

编辑-截至目前的完整代码〜

\documentclass[a4paper,10pt]{article}
\usepackage[margin=1in]{geometry}
\setlength{\parindent}{0pt}

%\newcommand\headone[1]{%
%  \begin{tabular}{@{}p{\linewidth}@{}}
% \textbf{#1} \\
% \hline
%\end{tabular}

\newcommand\headtitle[4]{%
\begin{tabular}{@{}p{\linewidth}@{}}
\textbf{#1} \\
\hline
{\bfseries #2 \hfill #3 \hfill #4} \\
%\mbox{}
\end{tabular}%
}

\renewcommand{\labelitemi}{\raise .5ex\hbox{\tiny$\bullet$}}


\begin{document}
\sffamily

% Top - Resume Header 

{  \small  \begin{tabular}[c]{l}
\texttt{\#1212, Block xzxzx3} \\
\texttt{ABCD, XYX} \\
\texttt{US CAN (IL) 1212121}
\end{tabular}} \hfill %
{\LARGE\bfseries\begin{tabular}[c]{c}
 SHASHWAT PANT
\end{tabular}}\hfill%
{ \small \begin{tabular}[c]{r}
 \texttt{(91) 1212122121}\\
 \texttt{(91) 12333636 }\\
 \texttt{@gmail.com}
 \end{tabular}}

 \vspace{.75 \baselineskip}

 \headtitle{Author}{Linux Journal}{2011}
 \quad Indepth Articles and Analysis
 \begin {itemize}
  \item Worked on an indepth  analysis on Secure boot, Intel's UEFI implementation, its       shortcommings and effect on Linux.
 \item Worked on a comprehensive comparison of various Display Managers covering implementation, development and performance aspect of each.
  \end{itemize}

  \headtitle{Author}{Linux Journal}{2011}
  \quad Indepth Articles and Analysis

 \end{document}

答案1

如果没有一个简单的例子,很难说;但我相信你需要的是

\newcommand\headtitle[4]{%
  \begin{tabular}{@{}p{\linewidth}@{}}
  \textbf{#1} \\
  \hline
  {\bfseries #2, \hfill #3 \hfill #4} \\
  \mbox{}
  \end{tabular}%
}

您希望表格具有整个线宽,因此您不想将其缩小两倍\tabcolsep,而是删除填充。

相关内容