2

I have a tabbing environment and I want next to some text lines a horizontal line up to the end of the page. \hrulefill won't work because of the tabbing. The \noindent\rule{x}{y} will put a line, but since the text lines end at a different point the lines with the defined length will too.

\documentclass{article}

\begin{document}

\begin{tabbing}
  \textbf{whatever short} \= \noindent\rule{20cm}{0.5pt} \\
  2005-2014 \> doesn't matter\\
  \> \textit{doesn't matter}\\
  2011-2012 \> doesn't matter\\
  \> \textit{doesn't mattter}\\
  \textbf{whaaaaaaateeeeeeeever long} \noindent\rule{13cm}{0.5pt} \\
  from 10/2012 \> first one\\
  \> \textit{2nd one}\\
  07/2015 - 12/2015 \> first one\\
  \> \textit{2nd one}
\end{tabbing}

\end{document}
1
  • Welcome to TeX.SX! Please help us help you by making your example compilable (MWE).
    – TeXnician
    Commented Jan 18, 2018 at 16:40

2 Answers 2

1

You can use tikz and tikzmark. It needs two compilations.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{calc}
\begin{document}


\begin{tabbing}
  \begin{tikzpicture}[overlay,remember picture]
  \path (0,0)--++(\textwidth,0) coordinate (yline);
  \draw (pic cs:a) -- ({pic cs:a} -| yline);
  \end{tikzpicture}%
  \textbf{whatever short} \= \tikzmark{a} \\
  2005-2014 \> doesn't matter\\
  \> \textit{doesn't matter}\\
  2011-2012 \> doesn't matter\\
  \> \textit{doesn't mattter}\\
  \begin{tikzpicture}[overlay,remember picture]
  \path (0,0)--++(\textwidth,0) coordinate (yline);
  \draw (pic cs:b) -- ({pic cs:b} -| yline);
  \end{tikzpicture}%
  \textbf{whaaaaaaateeeeeeeever long} \tikzmark{b} \\
  from 10/2012 \> first one\\
  \> \textit{2nd one}\\
  07/2015 - 12/2015 \> first one\\
  \> \textit{2nd one}
\end{tabbing}

\end{document}

enter image description here

1
  • Thanks so much. I solved it then with more than one tabbing environment. And to have always the same tab I did \hspace{5cm}\=\kill
    – patti
    Commented Jan 19, 2018 at 17:19
1

tabbing doesn't complain if a cell extends beyond the tab point.

\documentclass{article}
\usepackage{tabularx}

\newcommand{\single}[1]{%
  \textbf{#1}\ \=\kill
  \makebox[\textwidth][s]{\textbf{#1} \hrulefill}}

\begin{document}

\begin{tabbing}
\single{whatever short} \\
2005-2014          \> doesn't matter\\
                   \> \textit{doesn't matter}\\
2011-2012          \> doesn't matter\\
                   \> \textit{doesn't mattter}\\
\single{whaaaaaaateeeeeeeever long} \\
from 10/2012       \> first one\\
                   \> \textit{2nd one}\\
07/2015 -- 12/2015 \> first one\\
                   \> \textit{2nd one}
\end{tabbing}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .