Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I have a table, where one row has the same content as above, is there a representation for that in latex?

In Germany we sometimes use ------- " -------- to say that the line here is the same as above.

So instead of having this:

| title | description          |
| Bla   | no description       |
| Blubb | no description       |
| Blop  | no description       |
| Blip  | no description       |

Have something like this:

| title | description          |
| Bla   | no description       |
| Blubb | ---------"---------- |
| Blop  | ---------"---------- |
| Blip  | ---------"---------- |

Maybe not with the dashed line, but a straight line. Is there a command for that or any other way to say that one line is above the other, without writing "see above"?

Forgot to mention: I use the longtable environment. My column types are {c|lp{4cm}p{4cm}}

share|improve this question
1  
Related question: Is there a ditto symbol? –  diabonas Jul 13 '12 at 20:48
    
What is the column type of description? –  Werner Jul 13 '12 at 20:56
    
@diabonas Yes, that is the symbol I'm looking for. However, I would want to center the symbol, in a (To Werner) p{5cm} column type. –  cherrung Jul 13 '12 at 20:59
1  
Don't use "ditto marks"; if the value can be inferred from the line above omit it, otherwise write it. You'll do a favor to your readers. :) –  egreg Jul 13 '12 at 22:11
    
@egreg How come? Are there certain guidelines? –  cherrung Jul 13 '12 at 22:18

1 Answer 1

up vote 4 down vote accepted

Here's a draft of what you might be after, using the xhfill package (for leaders) and \textquotedbl (via the T1 encoding from fontenc, as suggested in Is there a ditto symbol?):

enter image description here

\documentclass[a4paper]{scrartcl}
\usepackage[T1]{fontenc}% http://ctan.org/pkg/fontenc
\usepackage{longtable}% http://ctan.org/pkg/longtable
\usepackage{xhfill}% http://ctan.org/pkg/xhfill
\newcommand{\ditto}[1][.4pt]{\xrfill{#1}~\textquotedbl~\xrfill{#1}}
\begin{document}

\begin{longtable}{c|lp{4cm}p{4cm}}
\hline
Title & Heading & Description & Blop \\
Bla   & A & no description & Blop \\
Blubb & B & \ditto & Blip  \\
Blop  & C & \ditto & Blubb \\
Blip  & D & \ditto[1pt] & Blop  \\
\hline
\end{longtable}
\end{document}​

xhfill is not really required, but it's small enough to use as-is. The default width of the leader/rule drawn by \xrfill is .4pt according to the definition of \ditto[<width>], unless specified otherwise.

share|improve this answer
    
Very nice. My textquotedbl results in curved quotes, instead of straigt ones. Is there a way to force straight ones? And I noticed that the lines are pretty close to the top row, especially if the text in a preceding column spans multiple rows. Is it possible to have a top margin? –  cherrung Jul 13 '12 at 21:49
    
If, by "pretty close to the top row" you mean that the leader (horizontal line) is "too high", you can use \xrfill[.7ex]{#1} in your definition of \ditto instead. \xrfill takes an optional argument that raises the horizontal leader (default is 1ex). –  Werner Jul 13 '12 at 22:00
2  
It may also be feasible to use \renewcommand{\textquotedbl}{\texttt{"}} if you don't want to use a different font encoding that supplies \textquotedbl (like T1 does). –  Werner Jul 13 '12 at 22:00
    
Thanks for the advice with \renewcommand. By "too close" I actually mean that if I have an \hline both the hline and the \ditto are very close to each other. See: d.pr/i/OHbM Would be nice to have a "top margin". –  cherrung Jul 13 '12 at 22:06
    
Perhaps try this definition of \ditto: \newcommand{\ditto}[1][1ex]{\xrfill[.7ex]{.4pt}~\rule{0pt}{#1}\textquotedbl~\xr‌​fill[.7ex]{.4pt}} and then you can use \ditto[\normalbaselineskip] for the first row with an \hline above it, and just \ditto everywhere else. The optional argument to \ditto now takes a length that denotes the vertical strut inserted rather than the width of the leader. The width is now fixed to .4pt (the usual LaTeX default rule width). –  Werner Jul 13 '12 at 22:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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