Sign up ×
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.

I have a basic table in the tabular environment, and I want to fill a cell with a dash, to show that there is nothing to go in that cell. I've tried just using dash, but can't get one that's long enough or connected.

share|improve this question
\hrulefill perhaps or that may be a bit low or you can use \rule to make any rule of any fixed length and height above the baseline – David Carlisle Apr 9 '13 at 10:31
perhaps the cancel package can be of use here (or perhaps – Sean Allred Apr 9 '13 at 10:45
\hrulefill does what I want it to, but it also messes up my cell colouring, where I've used \rowcolor – Danger Fourpence Apr 9 '13 at 10:46
I'd simply use -- or --- – egreg Apr 9 '13 at 10:50
@egreg I've tried those, they're too narrow for my liking – Danger Fourpence Apr 9 '13 at 11:01

1 Answer 1

up vote 2 down vote accepted

Here I define a \longdash command, by default it's (slightly less) than an em-dash; it has an optional argument: \longdash[4] is (slightly less than) four en-dashes.

\NewDocumentCommand{\longdash}{ O{2} }
  --\prg_replicate:nn { #1 - 1 } { \negthinspace -- }

Foo & Bar column & Baz column \\
123 & 456 & 789 \\
\longdash & 42 & \longdash[2] \\
\longdash & \longdash[3] & \longdash[4] \\

Filling with \rowcolor involved seems tricky and, in my opinion, not desirable. However, I would recommend simply using an em-dash for this.

enter image description here

share|improve this answer

Your Answer


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.