3

I have the following table in which I have placed an extra vertical space between the lines.

That space "works" in every line but in some cases it show no effect (space between the derivative and the integral).

Also when I use \hline between the lines then in some cases the formulas intersect with the lines (the derivative with the line under it), which I think that generally shouldn't happen with or without the extra space, and in others there is a lot of vertical space between the lines and the mathematical expressions (the exponential and the line above it).

Why is that happening? How can I fix that?

enter image description here

enter image description here

\documentclass[12pt]{article}

\usepackage{fontspec}

\usepackage[english,greek]{babel}

\usepackage[fleqn]{amsmath}

\usepackage{unicode-math}

\setmainfont
[
  Ligatures=TeX,
  Extension=.otf,
  UprightFont=*,
  BoldFont=*Bold,
  ItalicFont=*It,
  BoldItalicFont=*BoldIt,
  Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}

%Use of array as @cfr suggested
\usepackage{longtable,array}

\setlength{\extrarowheight}{0.5cm}

\setmathfont{latinmodern-math.otf}

\setmathfont[range=\varnothing]{Asana-Math.otf}

\setmathfont[range=\int]{latinmodern-math.otf}

\newcommand{\ds}{\displaystyle}

\begin{document}

\begin{longtable}[l]{l l}
Time Domain & Frequency Domain\\
$f(t)$ & $F(s)$\\
$f(t-t_{0})$ & $e^{-st_{0}}\cdot F(s)$\\
$e^{s_{0}t}\cdot f(t)$ & $F(s-s_{0})$\\
$\ds \frac{df}{dt}$ & $s\cdot F(s)-f(0)$\\
$\ds \int\limits_{-\infty}^{t}f(t)dt$ & $\ds \frac{1}{s}\cdot F(s)$\\
$f_{1}(t)\ast f_{2}(t)$ & $F_{1}(s)\cdot F_{2}(s)$
\end{longtable}

\end{document}
11
  • There is no vertical spacing added to the last line. It would be better, in any case, to adjust the settings generally rather than doing so row-by-row. Have you considered using booktabs? – cfr Dec 16 '14 at 1:57
  • @cfr When I say last line I mean between the last and its previous one. No I don't know what that is. :) – Adam Dec 16 '14 at 1:59
  • You would need `\\` at the end of the last row. By the way, your MWE does not compile. – cfr Dec 16 '14 at 2:00
  • @cfr I have tried adding "\\" before posting and it didn't work. Also I don't think that they are necessary in the last line. Thanks for the remark about the compilation error in my MWE, I fixed it! – Adam Dec 16 '14 at 2:11
  • 1
    @cfr Although you deleted your answer I would like you to know that the array from it was extremely helpful. :) – Adam Dec 16 '14 at 2:45
3

array allows you to add additional height to the rows of tabulars globally (or locally if you restrict the scope of the command, of course). This helps ensure consistency and makes it easy to adjust the layout if necessary. For example, you can say

\setlength{\extrarowheight}{5mm}

However, I think that you will get better results if you use an environment designed for mathematics rather than trying to squeeze display sized maths into an environment designed for text (with inline maths).

This example is not at all optimal but just to give the idea:

\documentclass[12pt]{article}

\usepackage{fontspec}

\usepackage[fleqn]{amsmath}

\usepackage{unicode-math}

\setmainfont
[
Ligatures=TeX,
Extension=.otf,
UprightFont=*,
BoldFont=*Bold,
ItalicFont=*It,
BoldItalicFont=*BoldIt,
Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}

\setmathfont{latinmodern-math.otf}

\setmathfont[range=\varnothing]{Asana-Math.otf}

\setmathfont[range=\int]{latinmodern-math.otf}

\newcommand{\ds}{\displaystyle}

\begin{document}


  \begin{align*}
    &\text{Time Domain} & &\text{Frequency Domain}\\
    &f(t) & &F(s)\\
    &f(t-t_{0}) & &e^{-st_{0}}\cdot F(s)\\
    &e^{s_{0}t}\cdot f(t) & &F(s-s_{0})\\
    &\ds\frac{df}{dt} & &s\cdot F(s)-f(0)\\
    &\ds\int\limits_{-\infty}^{t}f(t)dt & &\ds\frac{1}{s}\cdot F(s)\\
    &f_{1}(t)\ast f_{2}(t) & &F_{1}(s)\cdot F_{2}(s)\\
  \end{align*}


\end{document}

maths in <code>align*</code> environment rather than tabular

3
  • Thank you the array is really useful, but what I am trying to understand is why there is no space between the derivative and the integral. The t in the integral's limit is right under the derivative like the vertical space is not working. It is the same problem I had but now it is in another line. – Adam Dec 16 '14 at 2:23
  • @Adam It is adding vertical space as it would for text. If you look at the location of the baselines, you'll see that the additional space is there. But you are using displayed size maths as if it were inline maths and I think (though I'm by no means expert) that this is going to confuse the spacing. – cfr Dec 16 '14 at 2:30
  • 1
    I would get rid of the \limits instruction after \int. – Mico Dec 16 '14 at 4:10
2

Use the rules provided by booktabs, that ensure some space is set above and below them.

\documentclass[12pt]{article}

\usepackage{longtable,array,booktabs}

\begin{document}

\begin{longtable}[l]{
  >{$\displaystyle}l<{$}
  >{$\displaystyle}l<{$}
}
\toprule
\multicolumn{1}{c}{Time Domain} &
\multicolumn{1}{c}{Frequency Domain} \\
\midrule
f(t) & F(s)\\
\midrule
f(t-t_{0}) & e^{-st_{0}}\cdot F(s)\\
\midrule
e^{s_{0}t}\cdot f(t) & F(s-s_{0})\\
\midrule
\frac{df}{dt} & s\cdot F(s)-f(0)\\
\midrule
\int_{-\infty}^{t}f(t)\,dt & \frac{1}{s}\cdot F(s)\\
\midrule
\int\limits_{-\infty}^{t}f(t)\,dt & \frac{1}{s}\cdot F(s)\\
\midrule
f_{1}(t)\ast f_{2}(t) & F_{1}(s)\cdot F_{2}(s) \\
\bottomrule
\end{longtable}

\end{document}

enter image description here

I included both forms for the integral: I much prefer the one without \limits.

2
  • Thank you very much! But can you maybe explain to me what was the problem and there was that lack of space in the longtable causing the math formulas to almost overlap with each other and also with the lines, although I had used additional space? This is my main concern because it seems to me quite peculiar. – Adam Dec 19 '14 at 4:54
  • @Adam You set \extrarowheight to .5cm, which tells LaTeX the minimum height of rows should be increased by that amount. But the row with the integral goes beyond the minimum height, so no extra space is added; this is visible in the row with the derivative. With booktabs some vertical space is added above and below a \midrule, so the problem is solved in a different way. – egreg Dec 19 '14 at 7:25

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.