3

I used a tabular in middle of text, but there is little (vertical) space around the table inside the text. How can I increase the margin of this tabular (the distance between horizontal lines of table and the following and preceding paragraphs)?

some text....

\centering
\begin {tabular} {| c  c   c  c |}
\hline
$\tilde {d}$ text & $ein \downarrow$ & $ dvc \uparrow $ \\
$\tilde {d}$ text & text & $ein \uparrow$ & $ dvc \downarrow $ \\
\hline
\end {tabular}

some text ....
4
  • 1
    What do you mean exactly? Increase the distance between vertical rules and contents of the tabular?
    – Bernard
    May 21, 2016 at 9:41
  • @Bernard I edited the question to point that.
    – Ahmad
    May 21, 2016 at 11:49
  • @Ahmad: What are the \ein and \dvc macros?
    – Bernard
    May 21, 2016 at 11:54
  • @Bernard No matter what they are, I changed them to plain text.
    – Ahmad
    May 21, 2016 at 13:07

3 Answers 3

4

Here, environment center makes sense, because it adds space:

\begin{center}
  \begin{tabular}{...}
  ...
  \end{tabular}
\end{center}

Nicer lines are available with package booktabs:

\usepackage{booktabs}
...
\begin{center}
  \begin{tabular}{...}
    \toprule
    ...
    \bottomrule
  \end{tabular}
\end{center}

Full example:

\documentclass{article}
\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}
\lipsum[2]
\begin{center}
  \begin{tabular}{l}
    \toprule
     First tabular line\\
     Second tabular line\\
    \bottomrule
  \end{tabular}
\end{center}
\lipsum[3]
\end{document}

Result

1

I can make two suggestions

  • Embed the tabular environment in a center environment (and omit the \centering instruction), or

  • Embed the tabular environment, along with the \centering instruction, in a table environment, taking care to add [h!] as the positioning specifier in order not to let the environment "float" too far away. This method may be preferable as it makes it straightforward to specify a \caption.

enter image description here

\documentclass{article}

\newcommand\ein{ein} % dummy definitions to make the code compilable
\newcommand\dvc{dvc}

\begin{document}

some text\dots

\begin{center}
\begin {tabular} {|cccc|}
\hline
$\tilde {d}$ text & $\ein \downarrow$ & $ \dvc \uparrow $ & \\
$\tilde {d}$ text & text & $\ein \uparrow$ & $ \dvc \downarrow $ \\
\hline
\end {tabular}
\end{center}

some text \dots

\begin{table}[h!]
\centering
\begin {tabular} {| c  c   c  c |}
\hline
$\tilde {d}$ text & $\ein \downarrow$ & $ \dvc \uparrow $ & \\
$\tilde {d}$ text & text & $\ein \uparrow$ & $ \dvc \downarrow $ \\
\hline
\end {tabular}
\end{table}

some text \dots
\end{document}
1

The cellspace package defines minimal vertu=ical padding at the top and bottom of cells in columnns with specifiers prefixed by the letter S (or C if you use siunitx):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{array, cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

some text....

\begin{center}
  \begin {tabular} {|*{4}{Sc} |}
  \hline
  $\tilde {d}$ text & $ein \downarrow$ & $ dvc \uparrow $ & \\
  $\tilde {d}$ text & text & $ein \uparrow$ & $ dvc \downarrow $ \\
  \hline
  \end {tabular}
\end{center}
some text ..

\end{document} 

enter image description here

You must log in to answer this question.

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