2

I have a table with couple of equations and I'd like to add a small space between rows inside table and afer and before \hline. I already have the command \renewcommand{\arraystretch}{1.5} inside the preamble but it does not affect the space inside the table I want to modify. Would you know a solution to this? Red arrows indicate where I'd like to have some spacing. Thank you.table

\documentclass[a4paper]{article} 
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{float}
\usepackage{siunitx}
\begin{document} 

\begin{table}[H]
\caption{Table}
\label{Tab:table}
\centering
\begin{tabular}{l | ll}
  \hline
  \hline
  First-order pole & $\frac{1}{\pi R_\text{load}C_\text{out}}$ & \SI{100}{\hertz}\\
  Second-order pole & $\frac{f_\text{sw}}{\pi}{\big(\frac{1}{D(1+\frac{V_\text{in}}{NV_\text{out}})}\big)}^2$ & \SI{100}{\hertz} \\
  Left half-plane zero & $\frac{1}{2\pi R_\text{ESR}C_\text{out}}$ & \SI{100}{\hertz}\\
  Right half-plane zero & $\frac{R_\text{load}}{2\pi \frac{V_\text{out}}{NV_\text{in}}\big(1+ \frac{NV_\text{out}}{V_\text{in}}\big)L_p}$ & \SI{100}{\hertz}\\
  DC gain & $\frac{V_\text{in}}{D_\text{iv}}\sqrt{\frac{R_\text{load}f_\text{sw}}{2L_p}}\frac{1}{S_e+S_n}$ & \SI{100}{\hertz}\\
  Duty cycle & $\frac{V_\text{out}}{V_\text{in}}\sqrt{\frac{2L_pf_\text{sw}}{R_\text{load}}}$  &\SI{100}{\hertz}  \\
  \hline
\end{tabular}
\end{table}

\end{document}
4

You can use \\[the_additional_space_you_want] instead of \\ between two lines. For example, \\[2mm] will add 2 mm of additional vertical space between the two lines.

Edit: and to insert more space between the two first rules and the first line, you can insert a "strut" (a rule of width 0 and of the height you desire) between \hline\hline and the beginning of the line: for example \rule{0mm}{5mm} (first argument is the width, here 0, second is the height).

3

for more vertical space in cells package makecell provide macro \makegapedcells:

\documentclass[a4paper]{article}
\usepackage{nccmath}
\usepackage{makecell, tabularx}
\setcellgapes{5pt}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}

\begin{document}
    \begin{table}[htb]
\caption{Table}
\label{Tab:table}
\makegapedcells
\centering
\begin{tabular}{l | >{$\displaystyle}l<{$} >{\SI{100}{\hertz}}l}
  \Xhline{1pt}
\makecell[l]{First-order pole}
    &   \frac{1}{\pi R_\mathrm{load}C_\mathrm{out}}                         &   \\
Second-order pole
    &   \frac{f_\mathrm{sw}}{\pi}{
        \left(\frac{1}{D\left(1+
                \mfrac{V_\mathrm{in}}{NV_\mathrm{out}}\right)}\right)}^2    &   \\
Left half-plane zero
    &   \frac{1}{2\pi R_\mathrm{ESR}C_\mathrm{out}}                         &   \\
Right half-plane zero
    &   \frac{R_\mathrm{load}}{2\pi\mfrac{V_\mathrm{out}}{NV_\mathrm{in}}
        \left(1+ \mfrac{NV_\mathrm{out}}{V_\mathrm{in}}\right)L_p}          &   \\
DC gain
    &   \frac{V_\mathrm{in}}{D_\mathrm{iv}}
        \sqrt{\frac{R_\mathrm{load}f_\mathrm{sw}}{2L_p}}\frac{1}{S_e+S_n}   &   \\
Duty cycle
    &   \frac{V_\mathrm{out}}{V_\mathrm{in}}
        \sqrt{\frac{2L_pf_\mathrm{sw}}{R_\mathrm{load}}}                    &   \\
  \Xhline{1pt}
\end{tabular}
    \end{table}
\end{document}

enter image description here

edit:

as pointed Bernard in his comment, use of \makegapedcell has some issues (specific to this table); first cell in the first column is not left aligned. as cure for this mismatch in this cell i use \makecel[l]{...}.

beside this table looks is improved by with use of \displaystyle, nccmath package (both stolen from Bernard answer), caption package and Xhline from makecell package. also typing of units is shortened.

  • You have the same problem as I had, with \makegapedcells: the first row is indented, and I don't understand why… – Bernard Dec 18 '17 at 12:30
  • @Bernard, now i see ... before i didn't notice this and i'm preaty sure, that in other tables, where i use \makegapedcells, this not happen. i know, that it doesnt work in all circumstances (for example with m columns). i will investigate this later. – Zarko Dec 18 '17 at 13:31
  • It's also the first time I notice it, and it is for this particular table. – Bernard Dec 18 '17 at 13:46
3

A solution with cellspace, booktabs, caption for a decent spacing between caption and table, and a few other packages:

\documentclass[a4paper]{article}
\usepackage{amsmath, nccmath}
\usepackage{tabularx}
\usepackage{float, caption, booktabs, cellspace}
\setlength{\cellspacetoplimit}{6pt}
\setlength{\cellspacebottomlimit}{6pt}
\usepackage{siunitx}

\begin{document}

\begin{table}[H]
\caption{Table}
\label{Tab:table}
\centering
\begin{tabular}{l |>{$\displaystyle}Cl<{$}l}
 \toprule
 \midrule 
 First-order pole & \frac{1}{\pi R_\text{load}C_\text{out}} & \SI{100}{\hertz}\\
  Second-order pole & \frac{f_\text{sw}}{\pi}{\frac{1}{\Bigl(D\Bigl(1+\mfrac{V_\text{in}}{NV_\text{out}}\Bigr)\Bigr)^2} }& \SI{100}{\hertz} \\
  Left half-plane zero & \frac{1}{2\pi R_\text{ESR}C_\text{out}} & \SI{100}{\hertz}\\
  Right half-plane zero & \frac{R_\text{load}}{2\pi \mfrac{V_\text{out}}{NV_\text{in}}\Bigl(1+ \mfrac{NV_\text{out}}{V_\text{in}}\Bigr)^{\mathstrut}L_p} & \SI{100}{\hertz}\\
  DC gain & \frac{V_\text{in}}{D_\text{iv}}\sqrt{\frac{R_\text{load}f_\text{sw}}{2L_p}}\frac{1}{S_e+S_n} & \SI{100}{\hertz}\\
  Duty cycle & \frac{V_\text{out}}{V_\text{in}}\sqrt{\frac{2L_pf_\text{sw}}{R_\text{load}}} &\SI{100}{\hertz} \\
  \bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

  • add \displaystyle is good idea ... i'm curious, where you use cellspace? – Zarko Dec 18 '17 at 11:16
  • @Zarko: Actually, it was there for a first trial which didn't work, as itseemed incompatible with the >{$}l<{$}, so I changed for \setcellgapes (with some complications for the first row)… until I found your message and remembered the pre-specifier had to be C, not S, due to siunitx loading. So, thanks for your comment! I returned to the initial version, which is simpler. – Bernard Dec 18 '17 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.