# How to remove space in math mode inside a tabular environment

I'm using some semantics formula that contains both math symbols and text inside a p{} column in a tabular environment. The formula is too long to fit in the column, then LaTeX has to create new lines inside the formula.

The problem is that it adds much space between some symbols of the formula, and I'd like to know if there is a way to prevent that (other than telling LaTeX manually where to add new lines).

Here is a MWE:

\documentclass{article}

\begin{document}
\begin{tabular}[t]{rlp{5cm}}
{NP1} &$=$ &$\lambda{x_e}.~\textsc{gen}_{\textsc{e}}: \textrm{relevant}_c(\textsc{e})[\textrm{dance}(\textsc{e}) \wedge \textrm{beautiful}(\textsc{e}) \wedge \textrm{agent}(\textsc{e}) = x]$
\end{tabular}
\end{document}


In this example, the output looks like this:

Thanks for the help!

## 1 Answer

You can align the p-column. Based on this answer I added the following to your MWE

>{\raggedright}p{5cm}


Or to have the column to be automatically in math mode even insert the $-signs. \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}[t]{rl >{\raggedright\arraybackslash$}p{6.5cm}<{$}} {NP1} &$=\$ &\lambda{x_e}.~\textsc{gen}_{\textsc{e}}: \textrm{relevant}_c(\textsc{e})[\textrm{dance}(\textsc{e}) \wedge \textrm{beautiful}(\textsc{e}) \wedge \textrm{agent}(\textsc{e}) = x]
\end{tabular}
\end{document}

• Thank you for the help, that was simpler than what I expected! – lookkcn May 26 '14 at 13:01