制表符和换行

制表符和换行

我正在制作简历。我使用制表符环境,这样我的部分就会以 1cm 的缩进开始,并且我还可以右对齐日期。例如:

Education
    University of Coolness                                          2005
    Bachelor of Amazingness
    A relatively short description of what I did there......

我遇到的问题是,有些行超出了页面宽度,并且根据谷歌快速搜索,在制表环境中,似乎没有换行功能。

为了完整性,我使用的确切代码是:

\mysectitle{Education}

\begin{mysec}
    \bold{my degree} \`expected 2015 \\
\end{mysec}

我的环境定义如下:

\newcommand{\mysectitle}[1]{\vspace{1cm}\textsc{\Large \bold{#1}}

\myline\vspace{0.3cm}}
\newcommand\mytabs{\hspace*{1cm}\=\hspace{1cm}\=\hspace{2cm}}
\newenvironment{mysec}
  {\begin{tabbing}\mytabs\+\kill}
  {\end{tabbing}}

您是否建议改用表格环境?如果是,我该如何像在\'制表环境中一样在表格环境中右对齐日期?

谢谢!

答案1

下面描述的命令\tabfill在制表环境中可以很好地换行。一个缺点是文本位于一个不可中断的框内,因此它不会跨页中断。如果您保持描述简短,这将不是问题。

\documentclass{article}
\makeatletter

\newlength\tdima
\newcommand\tabfill[1]{%
      \setlength\tdima{\linewidth}%
      \addtolength\tdima{\@totalleftmargin}%
      \addtolength\tdima{-\dimen\@curtab}%
      \parbox[t]{\tdima}{#1\ifhmode\strut\fi}}

\newcommand\mytabs{\hspace*{1cm}\=\hspace{1cm}\=\hspace{2cm}}
\newenvironment{mysec}[1][\mytabs]
  {\begin{tabbing}#1\kill\ignorespaces}
  {\end{tabbing}}

\makeatother

\begin{document}

\noindent\textsc{Education}
\begin{mysec}
    \>University of Coolness    \>\` 2005\\
    \>\textbf{Bachelor of Amazingness}\>\` expected 2015\\
    \>\tabfill{A relatively short description of what I did there and it
       goes on and it goes on and it goes on and it goes on and it goes
       on and it goes on and it goes on ...}
\end{mysec}

\end{document}

在此处输入图片描述

相关内容