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

I was preparing a table in my research paper where I was having a formula in one column and the name of the Mathematician who discovered it in another column. I also want to cite the paper of the Mathematician where this formula is given besides the Mathematician's name (in the same column). For example, Ramanujan [21]. However, LaTeX doesn't like it and I am getting errors like

Command \mdseries invalid in math mode


Command \upshape invalid in math mode

which I don't understand.

I would be really grateful if someone can help me with circumventing these errors.

share|improve this question
Would you be able to produce a minimal working example (MWE) that illustrates this problem? It should start with \documentclass and end with \end{document}. It should allow us to reproduce the problem and provide a viable means to overcome this error. – Werner May 4 '13 at 5:36
Welcome to TeX.sx! – Marc van Dongen May 4 '13 at 6:34
up vote 4 down vote accepted

Without an example this is only an educated guess, but basically what you are looking for is table in which one column is holding a formula (ie in math mode) and one or more columns that hold text.

Now most of the commands for math do not work in text and vice versa which is why you are seeing such errors.

How to resolve this? Couple of ways:

  • simply put your text into a \text{Ramanujan \cite{foo}} command inside the formula. So if you for example use the array environment then all your columns are in math mode. Downside: you need to do this for every cell.
  • Better probably: use the arraypackage: then you can specify that some columns should have math inside, e.g.

           a^n+b^n=c^n & Fermat \cite{xyz} \\
share|improve this answer
Hello Frank, That worked! Thanks so much! – Atul Dixit May 4 '13 at 13:32
@AtulDixit if this is the solution for you, you should checkmark the answer to make this visible for others haveing the same or a similar problem – Frank Mittelbach May 4 '13 at 13:34

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.