[Tex/LaTex] Tabbing and line-wrapping

line-breakingtabbing

I'm making a CV. I use the tabbing environment so that my sections start with a 1cm indent, and I can also right-justify dates. For example:

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

The problem that I run into is that some of my lines go further than the page-width, and in the tabbing environment, there doesn't seem to be linewrapping, according to a quick google search.

For completeness, the exact code that I use is:

\mysectitle{Education}

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

where my environments are defined as:

\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}}

Would you recommend using the tabular environment instead? If so, how could I right-justify a date in tabular environment, in the same fashion as \' does in tabbing environment?

Thanks!

Best Answer

The \tabfill command described below works quite well inside the tabbing environment to wrap text. The one drawback is that the text is inside an unbreakable box so that it will not break across pages. If you keep the description short it will not be a problem.

\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}

enter image description here