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}​ 
3
  • I increased the height of the cells a little, is this good? Commented Mar 19, 2018 at 19:55
  • Yes, it is!! how did you do it? Commented Mar 19, 2018 at 19:57
  • I posted an answer with the code and explanation :) Commented Mar 19, 2018 at 20:15

2 Answers 2

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} 
0
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

1
  • You are very talented with LaTeX. I vote all +1. Commented Mar 19, 2018 at 21:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.