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'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.

share|improve this question
2  
Please add the preamble that is needed to make this code work. –  Ian Thompson Aug 24 '11 at 10:05
    
Added it now... –  pg-robban Aug 24 '11 at 10:19
add comment

1 Answer

up vote 6 down vote accepted

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}
share|improve this answer
3  
I presume the tikz is a mistake... –  Seamus Aug 24 '11 at 11:05
    
It is. Thank you! –  Jake Aug 24 '11 at 11:30
    
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 '11 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 '11 at 12:05
    
I'm using \usepackage[parfill]{parskip} at the beginning of the document. –  pg-robban Aug 24 '11 at 12:06
show 4 more comments

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.