TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not exactly sure how to format my LaTeX code for this website. So maybe someone can help me with that... I'm having trouble with a table in LaTeX:

  1. In the cell that says "Dimension of Sample", the text goes outside the box.

  2. I would like the 1,2,3 of the sample dimensions to be centered in the cells vertically

  3. I would like the main portion of the table entries to be left aligned without affecting the alignment for the rest of the table.

Any help is appreciated!

\multicolumn{1}{c}{} &  & \multicolumn{4}{c|}{\textbf{Dimension of Measurement}} & \multicolumn{1}{c}{\multirow{2}{*}{}}\tabularnewline
\multicolumn{1}{c}{} &  & \textbf{0} & \textbf{1} & \textbf{2} & \textbf{3}  \tabularnewline

\multirow{3}{*}{\rotatebox[origin=c]{90}{\textbf{Dimension of Sample}}} & \textbf{1} & \shortstack{P10\\No of fractures\\per unit length\\of borehole} & \shortstack{P11\\Length of\\fractures per\\unit length} &  &  & \textbf{\shortstack{Linear\\Measures}}\tabularnewline

 & \textbf{2} & \shortstack{P20\\No of fractures\\per unit\\area} & \shortstack{P21\\Length of\\fractures per\\unit area} & \shortstack{P22\\Area of\\fractures per\\unit area} &  & \textbf{\shortstack{Areal\\Measures}}\tabularnewline

 & \textbf{3} & \shortstack{P30\\No of fractures\\per unit\\volume} &  & \shortstack{P32\\Area of\\fractures per\\unit volume} & \shortstack{P33\\Volume of\\fractures per\\unit volume} & \textbf{\shortstack{Volumetric\\Measures}}\tabularnewline
\multicolumn{2}{c|}{} & \textbf{Density} &  & \textbf{Intensity} & \textbf{Porosity} & \multicolumn{1}{c}{}\tabularnewline
share|improve this question

With the aid of the array package (provides > and < syntax) and the own defined macro \mystack you can get there quite easily.

Note, that the whole table is to wide for the standard report margins. I did not try to correct that. (Orienting the table to landscape would help here.)



\begin{tabular}{|c|>{\bfseries}c|c|c|c|c|>{\bfseries}c|} \cline{3-6}
    \multicolumn{1}{c}{}                                                    &   & \multicolumn{4}{c|}{\textbf{Dimension of Measurement}}                                                                                                                                                                                      & \multicolumn{1}{c}{}               \\ \cline{3-6}
    \multicolumn{1}{c}{}                                                    &   & \textbf{0}                                                      & \textbf{1}                                              & \textbf{2}                                            & \textbf{3}                                              & \multicolumn{1}{c}{}               \\ \hline
    \multirow{3}{*}{\rotatebox[origin=c]{90}{\textbf{Dimension of Sample}}} & 1 & \mystack{P10\\ No of fractures\\ per unit length\\ of borehole} & \mystack{P11\\ Length of\\ fractures per\\ unit length} &                                                       &                                                         & \mystack[c]{Linear\\ Measures}     \\ \cline{2-7}
                                                                            & 2 & \mystack{P20\\ No of fractures\\ per unit\\ area}               & \mystack{P21\\ Length of\\ fractures per\\ unit area}   & \mystack{P22\\ Area of\\ fractures per\\ unit area}   &                                                         & \mystack[c]{Areal\\ Measures}      \\ \cline{2-7}
                                                                            & 3 & \mystack{P30\\ No of fractures\\ per unit\\ volume}             &                                                         & \mystack{P32\\ Area of\\ fractures per\\ unit volume} & \mystack{P33\\ Volume of\\ fractures per\\ unit volume} & \mystack[c]{Volumetric\\ Measures} \\ \hline
    \multicolumn{2}{c|}{}                                                       & \textbf{Density}                                                &                                                         & \textbf{Intensity}                                    & \textbf{Porosity}                                       & \multicolumn{1}{c}{}               \\ \cline{3-6}



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.