Text Formatting ⇒ Vertical Spacing in 'array' or 'tabular' Environment
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Vertical Spacing in 'array' or 'tabular' Environment
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Vertical Spacing in 'array' or 'tabular' Environment
- You can control (globally or locally) the height of array or tabular rows by redefining \arraystretch.
Code: Select all
\renewcommand{\arraystretch}{1.2}
- The \\ command accepts an optional argument where you can add valid lengths.
Code: Select all
\\[\medskipamount]
- The booktabs package provides the \addlinespace command which adds a predefined amount of space but also accepts an optional argument.
- The tabu package provides the \extrarowsep command which stretches also table rows, but is restricted to the »tabu« environment provided by this package.
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Vertical Spacing in 'array' or 'tabular' Environment
this works? because I tried it in a array environment and it doesn't produce any desirable effect if I use \\[\smallskipamount] or \\[\medskipamount] or \\[\bigskipamount]\\[\medskipamount]
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Vertical Spacing in 'array' or 'tabular' Environment
Yes.ghostanime2001 wrote:Are you surethis works? […]\\[\medskipamount]
Code: Select all
\documentclass[11pt]{article}
\begin{document}
\begin{tabular}{cc}\hline
Table Content & Table Content \\[\smallskipamount]\hline
Table Content & Table Content \\[\medskipamount]\hline
Table Content & Table Content \\[\bigskipamount]\hline
\end{tabular}
\[
\begin{array}{r@{\,=\,}l}\hline
(a+b) & a^2+2ab+b^2 \\[\smallskipamount]\hline
(a-b) & a^2-2ab+b^2 \\[\medskipamount]\hline
(a+b)(a-b) & a^2-b^2 \\[\bigskipamount]\hline
\end{array}
\]
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 402
- Joined: Fri May 20, 2011 9:41 am
Vertical Spacing in 'array' or 'tabular' Environment
Code: Select all
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage[makeroom]{cancel}
\usepackage[version=3]{mhchem}
\begin{document}
$\begin{array}[t]{@{}l@{}}
\ce{2Cu2O_{(s)} + $\underset{\begin{tabular}[t]{@{}c@{}}25.8 g\end{tabular}}{\ce{Cu2S_{(s)}}}$ -> 6Cu_{(s)} + SO2_{(g)}} \\[\bigskipamount]
\begin{aligned}[t]\ce{n_{\ce{Cu}}}&=\smash{\text{0.162 mol \cancel{\ce{Cu2S}}}\times\dfrac{\text{6 mol \ce{Cu}}}{\text{1 mol \cancel{\ce{Cu2S}}}}} \\ &=\text{0.972 mol}\end{aligned} \\[\bigskipamount]
\begin{aligned}[t]\text{theoretical yield}_{\ce{Cu}}&=\text{0.972 mol}\times\text{63.6 g/mol} \\ &=\text{61.82 g}\end{aligned}
\end{array}$
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Vertical Spacing in 'array' or 'tabular' Environment
The array environment is in in-line math mode. Try my first suggestion.ghostanime2001 wrote:For anything else other than the below code it works but not with this code specifically. I don't understand why […]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10