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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I use \multicolumn in a longtable environment to span all columns except for one? The \LT@cols counter is probably the way to go. However, doing arithmetics in LaTeX seems somewhat unconventional. Related to multicolumn-command which automatically uses all columns of the table?. What's needed is "\LT@cols minus one".

share|improve this question
You can use \numexpr\LT@cols-1. Without a MWE, answers too will be trivial ;) – Harish Kumar Mar 29 '14 at 10:29
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Christian Hupfer Mar 29 '14 at 10:46
up vote 7 down vote accepted

You can use \numexpr\LT@cols-1 and define your own multicolumn command like

  \multicolumn{\numexpr\LT@cols-1}{#1}{#2}%              %%#1 = alignment, #2 = content

and use it like


Full code:


\usepackage{booktabs, longtable}




A & B & C & D & E\\

\mbox{table continued from last page}\\
A & B & C & D\\


\mymc{r}{abc} & d\\
a & \mymc{c}{bcd}\\
 & b & c & d\\
 & b & c & d\\


enter image description here

share|improve this answer
Harish's answer have helped me to achieve what I wanted. \numexpr is the answer I was looking for. Thank you guys! – jhad Mar 29 '14 at 14:53

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.