Take the 2-minute tour ×
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.

I use WinEdit and try to make a table. The problem is that I can not move the text in a multirow to the second line. There are the packages I use:

\documentclass[12pt, a4paper]{article}
\usepackage{russ}
\usepackage[left=1cm,right=1cm,top=2cm,bottom=2cm]{geometry}
\usepackage{mathenv}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multirow}

\ifpdf
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}

\usepackage{rotating}
\begin{document}

% And there is a table (I left the text, which is not important, in Russian, 
% if you don't mind).

\begin{table}[h]
\begin{center}
\begin{tabular}{|p{1cm}|p{3cm}|p{5cm}|p{3cm}|}
\hline
  \multicolumn{2}{|c|}{Преобразователь}& Электрооптический  &n оптический\\
  \multicolumn{2}{|c|}{\quad} & коэффициент & фазовый \\
  \hline
  \multirow{3}{2cm}{\begin{sideways} nonlinear-crystal types \end{sideways}}& ZnTe & $r_{41}$=4.04 & 2 \\
  \cline{2-4}
  &GaP & $r_{41}$= 0.97& 4 \\
  \cline{2-4}
 &GaSe &$r_{41}$=14 & 0.7\\
  \cline{2-4}
 &GaAs&$r_{41}$=1.5& 2\\
  \cline{2-4}
 &CdTe & $r_{41}$=4.5&  \\
  \cline{2-4}
 &CdSe & $r_{41}$=18& \\
\hline
\end{tabular}
\caption{Параметры генераторов ТГц импульсов}
\label{5}
\end{center}
\end{table}

\end{document}

So, the turned phrase "nonlinear-crystal types" gets out beyond the table and I should move the word "types" to the second line of the column. I tried to use the command \tabularnewline, but it didn't work for me, maybe because I use it in a wrong way. Can you tell me how to do this?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Here's an alternative suggestion:

enter image description here

\documentclass[12pt, a4paper]{article}
\usepackage[left=1cm,right=1cm,top=2cm,bottom=2cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{multirow,graphicx}% http://ctan.org/pkg/{multirow,graphicx}
\begin{document}
\begin{table}[ht]
  \centering % as opposed to using \begin{center}...\end{center}
  \renewcommand{\arraystretch}{1.5}% Widen rows of table
  \begin{tabular}{|l|p{3cm}|p{5cm}|p{3cm}|}
    \hline
    \multicolumn{2}{|c|}{Some Russian} & Some more Russian & Russian again \\
    \multicolumn{2}{|c|}{\quad} & Mini-Russian & More Russian \\
    \hline
    \multirow{3}{*}{\rotatebox{90}{\parbox{4\normalbaselineskip}{nonlinear-crystal types}}}& ZnTe & $r_{41}=4.04$ & 2 \\
    \cline{2-4}
    & GaP & $r_{41}=0.97$& 4 \\
    \cline{2-4}
    & GaSe & $r_{41}=14$ & 0.7\\
    \cline{2-4}
    & GaAs & $r_{41}=1.5$ & 2\\
    \cline{2-4}
    & CdTe & $r_{41}=4.5$ & \\
    \cline{2-4}
    & CdSe & $r_{41}=18$ & \\
    \hline
  \end{tabular}
  \caption{Russian and more Russian}\label{awesome_table}
\end{table}
\end{document}

Some changes include:

  • Using \rotatebox from graphicx (loaded without the pdftex option, since it'll figure out the required mode by itself), rather than sideways from rotating;
  • Spread out the contents of the table using a modified \arraystretch. See Column padding in tables;
  • Contained the breakable "sideways text" to 4\normalbaselineskip. That is just short of 3*\arraystretch*\normalbaselineskip;
  • Used a l-column for the first column, and specified the width of the \multirow argument as natural (or *).
  • Maintained math mode across the relation within the second column to provide appropriate spacing around the symbols. Perhaps, as reference, see What is the difference between \mathbin vs. \mathrel?
share|improve this answer
add comment

Your Answer

 
discard

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.