TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

My scenario is to pass in a ratio (in fractional form as opposed to decimal form) to each table column definition.

The following code cannot be compiled.





A & B \tabularnewline\hline
A & B \tabularnewline\hline

share|improve this question
Josephs solution works for me (after adding \end{longtable} to the code). – Caramdir Dec 28 '10 at 11:10
It seems to me that your #1\linewidth-2\tabcolsep-2\arrayrulewidth doesn't work. I'm not sure what's happening, but I get a "-2" in the table. – Hendrik Vogt Dec 28 '10 at 12:59
@Hendrik, you need calc.sty. – xport Dec 28 '10 at 13:03
Then why didn't you include \usepackage{calc} in your code above? I'd suggest you remove the whole piece starting from "Joseph's solution does not work"; his code does work. You just forgot \end{longtable} as the error message says and as Caramdir already noted. – Hendrik Vogt Dec 28 '10 at 13:18
@Hendrik, I did not read well. Yes. It works :-) We need copy to clipboard button. – xport Dec 28 '10 at 13:21
up vote 7 down vote accepted

You cannot use \pgfmathsetratio here, as the arguments to the m box needs to expand to a number. Assuming you can use the e-TeX extensions then you can use an alternative definition:

share|improve this answer
thanks for the solution. It works after correcting my own code. – xport Dec 28 '10 at 13:29

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.