5

I have following example

\begin{tabbing}
Person1: \underline{Long info about Person1} \=
Person2: \underline{Shorter info} \>
\end{tabbing}

I want to fill the gap in second line before the \> with an underline. I tryed

Person2: \underline{Shorter info}\hrulefill \>

but it didn't work out.

  • welcome. did you try Person2: \underline{Shorter info }\> yet? – soc1c Jun 8 '12 at 15:57
  • 1
    Should the underline be connected to that of \underline{Shorter info} without showing a break? Note that \underline is put below the depth of its contents. Since Shorter info contains no descenders, it will be placed higher than that of Longer info. – Werner Jun 8 '12 at 16:02
  • Werner, underline height doesn't matter. The break in line after underline{Shorter info} is not desirable. – Victor Proon Jun 8 '12 at 17:04
5

In your code snippet, the following works, although it may require some tweaking for more complicated examples:

enter image description here

\documentclass{article}
\begin{document}
\begin{tabbing}
Person1: \underline{Long info about Person1} \= \\
Person2: \underline{Shorter info} \> \\
Person2: rlap{\underline{\hphantom{Long info about Person1}}}Shorter info
\end{tabbing}
\end{document}

The reason why this works is because Person1 is similar in width to Person2. If this is not the case, you can always use an extra tab marker \= to identify this location.

\rlap allows for a right overlap (of width 0pt), while \hphantom only takes the horizontal width into consideration (without typesetting anything). That is, no height, and therefore also no descenders. If you have descenders within Shorter info, a regular \phantom should suffice.

Here's an alternative view on something similar, this time using tabular:

enter image description here

\documentclass{article}
\begin{document}
\begin{tabbing}
First person: \hspace*{2em} \= \underline{Long info about Person1} \= \\
Second person: \> \underline{Shorter info} \> \\
Second person: \>\rlap{\underline{\hphantom{Long info about Person1}}}Shorter info
\end{tabbing}

\noindent\begin{tabular}{@{}l@{\hspace*{2em}}l@{}}
  First person: & Long info about Person1 \\ \cline{2-2}
  Second person: & Shorter info \\ \cline{2-2}
\end{tabular}
\end{document}
  • You even don't need tabbing in this soolution. But you have to edit in 2 more places to change prson1's info. I thought that maybe there is a way to autpomatically fill those gaps using tabbing.. – Victor Proon Jun 8 '12 at 16:59
  • @VictorProon: I know, hence my statement about the width of Person1 and Person2. I've added an alternative using tabular. Not entirely sure about the context of your usage, so these are just suggestions. – Werner Jun 8 '12 at 17:10
0

Well, simply add a space character to the \underline{} command:

\begin{tabbing}
 Person1: \underline{Long info about Person1} \=
 Person2: \underline{Shorter info }\>
\end{tabbing}

This works for me. Did I understand your question correctly? If not, please add a minimal working example.

  • Look at Werner's comment. I want to get the effect similar to what happens in line3 of his example. – Victor Proon Jun 8 '12 at 17:00
  • Got it, I'm off the track. Werner's answer looks good tho. – soc1c Jun 8 '12 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.