8

I'm trying to make a two-column table environment. The left column is supposed to center the sideways text "Tips" vertically and the right column should be a normal paragraph column. Here's what I have so far:

\documentclass[12pt]{book}
\usepackage{rotating} % for sideways
\usepackage{array}    % for the m centering

\newenvironment{tips}
{
    \begin{tabular}{m{5mm}|p{0.9\textwidth}}
    \begin{sideways} \textbf{Tips} \end{sideways} &
}
{\end{tabular}}

I have tried both m and c, but the left column text is still at the top. enter image description here

This also gives me the problem that for longer texts in the left column, the vertical space before the table becomes larger. Any help?

Also, a quick second question: Is there a unit which makes the second column "fill out" the remainder of the page horizontally? I'm missing out a couple of millimeters using 0.9*\textwidth.

2
  • 2
    Please add the preamble that is needed to make this code work. Aug 24, 2011 at 10:05
  • Added it now...
    – pg-robban
    Aug 24, 2011 at 10:19

1 Answer 1

8

Instead of using the sideways environment, I would suggest using a \rotatebox{90}{...}.

\documentclass{scrartcl}
\usepackage{array}
\usepackage{rotating}
\newenvironment{tips}
{
\noindent
\begin{tabular}{m{0.03\textwidth}|m{0.97\textwidth}}
\rotatebox{90}{\textbf{Tips!}}&
}
{\end{tabular}
\bigskip
}

\begin{document}
\begin{tips}
Short Tip
\end{tips}

\begin{tips}
Forsok att undvika mer an fyra nastlade nivaer. Senare kapitel kommer ge dig forslag pa hur du kan strukturera om koden sa att du slipper onodig nastling. Forsok att undvika mer an fyra nastlade nivaer. Senare kapitel kommer ge dig forslag pa hur du kan strukturera om koden sa att du slipper onodig. nastling
\end{tips}
\end{document}
8
  • 3
    I presume the tikz is a mistake...
    – Seamus
    Aug 24, 2011 at 11:05
  • Quick follow-up question: The right column now ignores my paragraph spacing (empty line after each paragraph). How do I get this back? Setting it to p gives me the original error.
    – pg-robban
    Aug 24, 2011 at 12:02
  • @pg-robban: How did you define that paragraph spacing? Could you edit your question to make a complete minimal example document?
    – Jake
    Aug 24, 2011 at 12:05
  • I'm using \usepackage[parfill]{parskip} at the beginning of the document.
    – pg-robban
    Aug 24, 2011 at 12:06
  • @pg-robban: Using parskip doesn't have any influence on the paragraph spacing inside the tabular for me, regardless of the cell type used. It would be good if you could create a minimal example document.
    – Jake
    Aug 24, 2011 at 12:13

You must log in to answer this question.

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