[texhax] Boxes and indents

Philip G. Ratcliffe philipratcliffe at tiscali.it
Thu Jan 27 21:19:14 CET 2005


> I'd like to create a framed box right after a section header. The box 
> should use the entire column width (like \vbox do). The paragraph after 
> the box should have no indent, just like after a \section command. The 
> basic idea so far is something like:
> 
>    \newcommand{\infobox}[1]{\fbox{\vbox{#1}}
> 
>    \section{A new section}
> 
>    \infobox{A short description\\forced on two lines.}
> 
>    This is the section text...
> 
> The problems so far is (1) text inside \vbox is first-line-indented, (2) 
> the section text after the \infobox is also indented, and I would prefer 
> not to force this with \noindent.

Try this (it should be obvious how to modify it):

\documentclass{article}
\makeatletter
\newcommand{\infobox}[1]{%
  \fbox{\vbox{\noindent #1}}\vspace*{\baselineskip}\@afterheading
}
\makeatother
\begin{document}
\section{A new section}
\infobox{A short description\\forced on two lines.}
This is the section text...
\end{document}

Cordialmente,  Philip G. Ratcliffe
-----------------------------------------
Professor of Nuclear & Subnuclear Physics
Dipartimento di Fisica e Matematica
Universita degli Studi dell'Insubria
via Valleggio 11
22100 Como (CO)
Italy

Tel. +39 (031) 238.6231
Fax  +39 (031) 238.6119
Cell +39 (340) 2346580
Web  http://www.unico.it/~pgr
-----------------------------------------



More information about the texhax mailing list