0

In my Latex documents I usually include arrays and tables with fraction that always get crushed to their inline form, giving an unpleasant result. I know I could solve the issue by switching every \frac to \dfrac and adjusting the vertical spaces between lines manually, but I was wondering if there's a quicker and smarter way to solve this. I checked the array package but I didn't seem to find anything about this issue.

Here's a MWE of an array crushing fractions:

\documentclass{article}
\usepackage{amsmath, array}

\begin{document}

\begin{equation*}
\begin{array}{ll}
\frac{\partial T}{\partial \dot{x}}=m \dot{x}\quad \frac{d}{d t}\left(\frac{\partial T}{\partial \dot{x}}\right)=m \ddot{x}\quad \frac{\partial T}{\partial x}=0 \\
\frac{\partial T}{\partial \dot{y}}=m \dot{y}\quad \frac{d}{d t}\left(\frac{\partial T}{\partial \dot{y}}\right)=m \ddot{y}\quad \frac{\partial T}{\partial y}=0 \\
\frac{\partial T}{\partial \dot{z}}=m \dot{z}\quad \frac{d}{d t}\left(\frac{\partial T}{\partial \dot{z}}\right)=m \ddot{z}\quad \frac{\partial T}{\partial z}=0
\end{array}
\end{equation*}

\end{document}

EDIT: What I'm looking for (not sure it exists) is an environment, or a "declaration" valid through the whole environment, switching every math element to \displastyle, just like the \dcases environment for the regular \cases one.

3
  • 1
    Can you please add a minimal working example? Are there anything else in the cells besides math? Maybe the mode=dmath from the tabularray package might be handy. Commented Feb 11, 2023 at 19:28
  • @samcarter_is_at_topanswers.xyz sure, I just edited the question with a MWE (sorry I'm new to the site), usually there's nothing else in them except for math. I'll start looking the math mode up. How does it work if I can ask? Commented Feb 12, 2023 at 12:50
  • The problem with making all math to use display style automatically is that this will result in poor line spacing in case you happen to have some inline math in your text. If you want display styles for tables etc., you should only use diplsay style and not for your whole document. Commented Feb 12, 2023 at 12:59

2 Answers 2

0

If you use environments from the tabularray package for your arrays and tables, you can use mode=dmath for the cells which contain math. This will make them show up in display style.

A short example:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}
\begin{document}

\[
\begin{+array}{
  colspec={X},
  cells={mode=dmath}
}
\frac{1}{2}\\
\end{+array}
\]

\begin{tblr}{
  colspec={c},
  cells={mode=dmath}
}
\frac{1}{2}
\end{tblr}

\end{document}
2
  • Thanks. It does work. I'll have to look the documentation up for all the new features but its going to work. Thanks again! Commented Feb 12, 2023 at 13:05
  • @5kywAlker43 You're welcome! Commented Feb 12, 2023 at 13:05
0

well if I understood you question well, you're seeking to produce a table with math expressions, I would do that using array environment instead of tabular (you don't want to use $ in every cell, don't you :D), speaking of \dfrac and \frac, well the nccmath package provide medium size fractions which is \mfrac, let's give what we've said a shot, and let's create a small integration table (I'm not trying to remind you of calc II don't worry) :

\documentclass{article}
\usepackage{amssymb, nccmath}
\usepackage{makecell}

    \begin{document}
        \[
    \setcellgapes{5pt}
    \makegapedcells
    \begin{array}{|c|c|c|}
    \hline
    \makecell[l]{\mathbb{R}_+^*}  & x^n  & \mfrac{x^{n+1}}{n+1}+c \\
    \hline
    \mathbb{R}^*    & \mfrac{1}{x} & \ln \vert x\vert +c \\
    \hline
    \mathbb{R}      & e^{\lambda x} & \mfrac{1}{\lambda}e^x+c \\
    \hline
    \mathbb{R}      & \cos(\omega x)  & \mfrac{1}{\omega}\sin(\omega x)+c \\
    \hline
    \mathbb{R}      & \sin(\omega x)  & \mfrac{1}{\omega} \cos(\omega x)+c \\
    \hline
    \end{array}
        \]
    \end{document}

Here's the compilation result :

enter image description here

The code is pretty simple, for more vertical space around cells content you would employ \setcellgapes defined in the makecell package, there's also a problem of alignment in the first cell, so adding \makecell[l]{} will fix the problem.

Anyways I hope this will help you, this is how I usually make tables when all the cells contains mathematical expressions.

1
  • Thanks for the answer! I'll surely use \mfrac and the \array environments suggestion will be useful. I wasn't clear enough while writing the question so I edited it.. but still thanks! Commented Feb 12, 2023 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .