2

I am trying to implement the following table (picture seen) in LaTeX. I am facing difficulty in writing the code since it consists of both multicolumn and multirow table commands. I truly appreciate if you guys can help me with it:

Trying to get close to this:

Here is the initial part of code using multicolumn and multirow, I can't understand where I am getting it wrong:

\begin{table}[tp]
\toprule
\renewcommand{\arraystretch}{1.3}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.12mm}
\caption{VSI Parameters}  
\label{tab:2}
\centering
\begin{tabular}{t|t|t|t}
\hline
\hline
\multicolumn{2}{*}{\textbf{VSI Controller}  \\
                       \textbf{Parameters} \\
&  \textbf{Minimum}  &  \textbf{Maximum}   \\
&    \textbf{Value}  &   \textbf{Value}    \\\otoprule
\hline
\hline
\multirow{4}{*}{Outer Control Loops} & \math{k_{p1}} & \SI{0.002}{} \\
& \math{T_{i1}} & \SI{0.0001}{} \\
& \math{k_{p2}} & \SI{0.01}{} \\
& \math{T_{i2}} & \SI{0.0001}{} \\ \hline  



\end{tabular}
\end{table}

EDITED: @Bernard: I really like your format; if I opt for it in making all my tables, what is the modified code for the below table in my script:

\begin{table}[tp]
\toprule
\renewcommand{\arraystretch}{1.3}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.12mm}
\caption{Step Changes}
\label{tab:1}
\centering
\begin{tabular}{t|t|t}
\hline
\hline
Step Change   &  Initial &  Final \\
Number        &    $\math{(W)}$  &   $\math{(W)}$ \\\otoprule
\hline
\hline
\SI{1}{}   &   \SI{0}{}  &   \SI{500}{}\\
\hline
\SI{2}{}    &   \SI{500}{}    &   \SI{250}{}\\
\hline
\SI{3}{}    &   \SI{250}{}    &   \SI{750}{}\\
\hline
\hline
\end{tabular}
\end{table} 
8
  • 2
    Which document class do you use and which table related packages do you call? Can you please complete your code snippet to be compliable? Wellcome to TeX.se!
    – Mensch
    Commented Sep 27, 2015 at 21:58
  • Welcome to TeX SX! The image does not correspond to the code.
    – Bernard
    Commented Sep 27, 2015 at 22:15
  • Thanks you guys! I am using \documentclass[conference]{IEEEtran}
    – Hans
    Commented Sep 27, 2015 at 22:47
  • If I knew how to make it work, I wouldn't ask you guys Kurt; I appreciate if you could make it running. @Bernard: most of the code is there, but I cant generate it in LateX as it is giving me error. I made the upper table in word.
    – Hans
    Commented Sep 27, 2015 at 22:50
  • Please give us a complete, small document which we can compile to reproduce the problem - even if that is a compilation error. Right now, people have to guess how \otoprule is defined and what might provide \SI or what t and \doublerulesep are. You need help solving the problem. But we need you to help by setting the problem up.
    – cfr
    Commented Sep 27, 2015 at 23:17

3 Answers 3

3

Here is a solution, using makecell, siunitx, caption and booktabs. I removed all vertical rules for a more professional look:

\documentclass{article}

\usepackage{makecell, caption, booktabs, multirow, siunitx}
\renewcommand\theadfont{\bfseries}
\renewcommand\cellalign{lc}
\newcommand{\otoprule}{\midrule[\heavyrulewidth]}
\usepackage{lipsum, fancyvrb}

\begin{document}

\lipsum[3]

\begin{table}[tp]

  \renewcommand{\arraystretch}{1.3}
  \caption{VSI Parameters}
  \label{tab:2}
  \centering
  \begin{tabular}{@{}p{25mm}>{$}c<{$}@{\hskip1.5em}S[table-format=1.4]S[table-format=1.1]@{}}
    \toprule
    \multicolumn{2}{@{}l}{\bfseries\makecell{VSI Controller\\ Parameters}} & {\thead{Minimum\\Value}} & {\thead{Maximum\\Value}} \\
    \otoprule
    \multirowcell{4}{Outer Control \\ Loops} & k_{p_1} & 0.002 & 5 \\
                                   & T_{i_1} & 0.0001 & 0.5 \\
                                   & k_{p_2} & 0.01 & 3 \\
                                   & T_{i_2} & 0.0001 & 0.5 \\
    \midrule
    \multirowcell{4}{Inner Control \\ Loops} & k_{p_3} & 0.1 & {\Verb+15+} \\
                                   & T_{i_3} & 0.001 & 0.5 \\
                                   & k_{p_4} & 0.1 & {\Verb+10+} \\
                                   & T_{i_4} & 0.001 & 0.5 \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document} 

enter image description here

9
  • Thanks a lot Bernard. This is a great table, however when I add the packages you listed, it affects my other tables and changes their styles. I considered moving the following lines to the relevant table only, but it didn't help: \renewcommand\theadfont{\bfseries} \renewcommand\cellalign{lc} \newcommand{\otoprule}{\midrule[\heavyrulewidth]}
    – Hans
    Commented Sep 28, 2015 at 1:35
  • To mention: packages multirow, siunitx I had already been using and don't cause any problem. Packages I am using: \usepackage{siunitx} \usepackage{amsmath} \usepackage{graphicx} \usepackage{array} \usepackage{multirow}
    – Hans
    Commented Sep 28, 2015 at 1:46
  • You should post a minimal example of what's happening, so I can look at it tomorrow.
    – Bernard
    Commented Sep 28, 2015 at 2:01
  • by the way: (1) in inner control loop the last column values are not aligned vertically; I am using \verb+ + for 15 and 10, but still can't make it fall in one line. what is your suggestion?
    – Hans
    Commented Sep 28, 2015 at 2:15
  • How can I adjust the lengths of the table to make "VSI Control Parameters" column wider?
    – Hans
    Commented Sep 28, 2015 at 2:16
2

Something like this? Note that I've had to change your code quite a bit as I had no idea what half of the commands were meant to do or where to find them. For example, I've used c column types, $...$, removed \otoprule and \toprule (which makes no sense outside a tabular with booktabs, and I've no idea what else might define it) etc.

\documentclass[conference]{IEEEtran}
\usepackage{siunitx,array,multirow}

\begin{document}
\begin{table}[tp]
% \toprule% you can only use this within a tabular and if you load booktabs
\renewcommand{\arraystretch}{1.3}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.12mm}
\caption{VSI Parameters}
\label{tab:2}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\textbf{VSI Controller}}  &\textbf{Minimum}  &  \textbf{Maximum}   \\
\multicolumn{2}{|c|}{\textbf{Parameters}} & \textbf{Value}  &   \textbf{Value}    \\%\otoprule
\hline
\multirow{4}{*}{Outer Control Loops} & $k_{p1}$ & \SI{0.002}{} &\\
& $T_{i1}$ & \SI{0.0001}{} &\\
& $k_{p2}$ & \SI{0.01}{} &\\
& $T_{i2}$ & \SI{0.0001}{} &\\ \hline

\end{tabular}
\end{table}
\end{document}

This at least compiles, though it is not an especially professional-looking table:

non-pro table

But, if you are submitting using a designated class, you should probably be following their formatting guidelines for tables anyway. (If they have any.)

5
  • Thanks for the explanations and comments. This is in accordance with IEEE format, however it is not professional looking though. Could you make it alike user Bernard has made looking professional, without using booktabs package?
    – Hans
    Commented Sep 28, 2015 at 1:39
  • IEEEtran does not have any specific guideline for tables
    – Hans
    Commented Sep 28, 2015 at 1:48
  • @Hans I always use booktabs. Just use Bernard's code. He's the expert on this. Take a look at makecell. Maybe that will work better with whatever unknown code conflicts with booktabs. (I assume that's why you want to avoid booktabs.) Or Bernard has already offered to take a look if you post a proper minimal example.
    – cfr
    Commented Sep 28, 2015 at 2:52
  • @Hans Incidentally, your question asked for a table like the one you made in Word. If you had asked for something professional-looking, I'd have written a different answer.
    – cfr
    Commented Sep 28, 2015 at 2:54
  • I completely agree with you. Thanks for bringing this post alive and initiating it. I wish I had enough points to vote up all these great answers.
    – Hans
    Commented Sep 28, 2015 at 3:01
2

EDit: I changed to your given document class.

Okay, to help you to get a start for your table please see the following MWE:

%\documentclass[a4paper,12pt]{article}
\documentclass[conference]{IEEEtran}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{booktabs}
\usepackage{multirow,array}
\usepackage{siunitx}


\begin{document}
Test
\begin{table}

\renewcommand{\arraystretch}{1.3}
\caption{VSI Parameters}  
\label{tab:2}
\centering
\begin{tabular}{p{4cm}ccc}
\toprule
\multicolumn{2}{c}{\textbf{VSI Controller}} &  \textbf{Minimum}  &  \textbf{Maximum}   \\
                 &                          &    \textbf{Value}  &   \textbf{Value}    \\
\midrule
\multirow{4}{*}{Outer Control Loops} % first colum for 4 rows
                 & ${k_{p1}}$               & \SI{0.002}{}       & 5 \\
                 & ${T_{i1}}$               & \SI{0.0001}{}      & 0.5\\
                 & ${k_{p2}}$               & \SI{0.01}{}        & 3\\
                 & ${T_{i2}}$               & \SI{0.0001}{}      & 5\\ 
\bottomrule
\end{tabular}
\end{table}
\end{document}

I did a little pretty printing to make the table better visable for the creation.

Command \multicolumn{2}{c}{\textbf{VSI Controller}} spans two columns and centers the text. In your code the closing } is missing.

Command \multirow{4}{*}{Outer Control Loops} defines for 4 rows in your case the first column. The second column is written after the usual &. In the next rows just let the first column be empty (please study the given table code).

How to go on depends on your code and used packages. But this code is a start to prepare your table. I do not like table lines so I deleted them to show you an alternative ...

Result with article:

enter image description here

Result with IEEEtran:

enter image description here

0

You must log in to answer this question.

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