2

I am making a relatively simple table in LaTeX however, I came across a problem. I am trying to make the following table: enter image description here

However, I get the following:

enter image description here

My MWE is the following:

\documentclass{article}
\usepackage{graphicx,multirow}
\setbox0\hbox{\tabular{@{}l}Hydrocarbons\endtabular}
\begin{document}
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{System} & K-Model & H-Model \\
\hline
\multirow{4}{*}{\rotatebox{90}{\rlap{\usebox0}}} \\ 
& Ordinary & SRK &SRK  \\ \cline{2-4}
& Cryogenics & PR & PR \\ \cline{2-4}
& Crude & CS, GS & LK \\ \cline{2-4}
& Vacuum Crude & ESSO & LK\\ \hline
\hline
\multicolumn{2}{|c|}{Power combustion} & SRK &SRK \\ \hline
\multicolumn{2}{|c|}{Acid, Bases, Electrolytes} & Electrolytes Models &SRK, 
HTSL\\ \hline
\multicolumn{2}{|c|}{Chemicals} & Activity Coeff. & Latent Heat\\ \hline
\end{tabular}
\end{document}​
  • I increased the height of the cells a little, is this good? – Phelype Oleinik Mar 19 '18 at 19:55
  • Yes, it is!! how did you do it? – user151562 Mar 19 '18 at 19:57
  • I posted an answer with the code and explanation :) – Phelype Oleinik Mar 19 '18 at 20:15
2

I changed a few things:

  • I changed the \box0 to a \newbox\dontdoitbox. If you use box registers directly you may overwrite things you shouldn't overwrite. I put an automatic register instead (But still there's no point in using a box here...).

  • I removed the \rlap from the \usebox. The \rlap makes the box start at the center of the cell, instead of the bottom.

  • I included the array package and put \setlength{\extrarowheight}{6pt} to increase the height of the cells of the table to make everything fit.

Here's the result:

enter image description here

The code:

\documentclass{article}
\usepackage{graphicx,multirow}
\usepackage{array}
\setbox0\hbox{\tabular{@{}l}Hydrocarbons\endtabular}
\begin{document}
\pagenumbering{gobble}
\setlength{\extrarowheight}{6pt}
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{System} & K-Model & H-Model \\
\hline
\multirow{4}{*}{\rotatebox{90}{\usebox0}}
& Ordinary & SRK &SRK  \\ \cline{2-4}
& Cryogenics & PR & PR \\ \cline{2-4}
& Crude & CS, GS & LK \\ \cline{2-4}
& Vacuum Crude & ESSO & LK\\ \hline
\hline
\multicolumn{2}{|c|}{Power combustion} & SRK &SRK \\ \hline
\multicolumn{2}{|c|}{Acid, Bases, Electrolytes} & Electrolytes Models &SRK, 
HTSL\\ \hline
\multicolumn{2}{|c|}{Chemicals} & Activity Coeff. & Latent Heat\\ \hline
\end{tabular}
\end{document}
2

an alternative with use of packages makecell and rotating:

\documentclass{article}
\usepackage{makecell,multirow}
\usepackage{rotating}

\begin{document}
    \begin{center}
\setcellgapes{5pt}
\makegapedcells
\settowidth\rotheadsize{Hydrocarbons}
\begin{tabular}{|c|c|c|c|}
    \hline
\multicolumn{2}{|c|}{System}
                    & K-Model   & H-Model       \\\hline
    & Ordinary      & SRK       & SRK           \\ \cline{2-4}
    & Cryogenics    & PR        & PR            \\ \cline{2-4}
    & Crude         & CS, GS    & LK            \\ \cline{2-4}
\multirow[t]{-4}{*}{\rothead{Hydrocarbons}}
    & Vacuum Crude  & ESSO      & LK            \\ \hline
\hline
\multicolumn{2}{|c|}{Power combustion}
                    & SRK       & SRK           \\ \hline
\multicolumn{2}{|c|}{Acid, Bases, Electrolytes}
                    & Electrolytes Models
                                & SRK, HTSL     \\ \hline
\multicolumn{2}{|c|}{Chemicals}
                    & Activity Coeff.
                                & Latent Heat   \\ \hline
\end{tabular}
    \end{center}
\end{document}​

enter image description here

  • You are very talented with LaTeX. I vote all +1. – Sebastiano Mar 19 '18 at 21:52

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.