1

i want the second "diffusivity" verticallay centered within its obvious scope enter image description here

MWE

  \documentclass{scrreprt}
  \usepackage{amsmath}
  \begin{document}
  \begin{table}
   \centering
   \begin{tabular}{c c c c}
    \hline
    Variable &Region Variable &Value &Unit \\ \hline

    area &$A$ &0 &m\\ \hline

     &$L_{1}$ &0 &m\\
    lengths &$L_{2}$ &0 &m\\
     &$L_{3}$ &0 &m\\ \hline

     &$D_{1}$\\
     diffusivity &$D_{2}$\\
     &$D_{3}$\\ \hline

    diffusivity &$D_{1}$\\
     &$D_{2}$\\ \hline

\end{tabular}
\caption{xyz}
\label{tab:para}
\end{table}
\end{document}
1

2 Answers 2

3

You can do it with the makecell package (less code since it allows for line breaks inside cells). I also used the booktabs package, to have a less tight vertical spacing between rows:

\documentclass{scrreprt}
\usepackage{amsmath}

\usepackage{booktabs, makecell}

\begin{document}

\begin{table}
\centering
    \begin{tabular}{r c c c}
    \toprule
    \makecell{Variable} & \makecell{Region\\ Variable} &Value &Unit \\
    \midrule
    area &$A$ &0 &m\rlap{\textsuperscript 2}\\
    \addlinespace[1.5ex]
    lengths &\makecell{$L_{1}$\\$L_{2}$\\$L_{3}$ }&\makecell{0\\0\\0} &\makecell{m\\m\\m}\\
    \addlinespace[1.5ex]
     diffusivity &\makecell{$D_{1}$\\$D_{2}$\\$D_{3}$}\\
    \addlinespace[1.5ex]
    diffusivity &\makecell{$D_{1}$\\$D_{2}$}
     &\\
     \bottomrule
    \end{tabular}
\end{table}

\end{document} 

enter image description here

2
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{c c c c}
\hline
Variable &Region Variable &Value &Unit \\ \hline
area &$A$ &0 &m\\ \hline
&$L_{1}$ &0 &m\\
lengths &$L_{2}$ &0 &m\\
&$L_{3}$ &0 &m\\ \hline
&$D_{1}$ &0\\
diffusivity &$D_{2}$ &0\\
&$D_{3}$ &0\\ \hline
\multirow{ 2}{*}{diffusivity} & $D_{1}$ & 0 & \\
& $D_{1}$ & 0 & \\ \hline
\end{tabular}
\caption{A test caption}
\label{table2}
\end{table}
\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 .