Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

changing \textwidth on the fly

5 views
Skip to first unread message

Paulo Abreu

unread,
Apr 4, 1999, 4:00:00 AM4/4/99
to
Hi!

I've found a not-so-pretty-way of changing the text width in the middle
of a document and I was wondering if there might be a better way in
LaTeX..

The book I'm working on has chapters with one column and wide margins
for marginal notes. At the end of each chapter there are exercises that
should be typeset with two columns and using the marginal note space.

I solved the problem of changing the width of the text by putting each
chapter and each section of exercises in a file of its own which is
\included in a main file, not \inputed. I've also created two .sty
files. One with the general macros and layout command (lets call it
general.sty) and the other just with the wide text width (wide.sty).
When I typeset a chapter, I have a \usepackage{general}. When I typeset
a section of exercises, I add a \usepackage{wide}. With some minor
additions to take care of correct chapter numbers and running heads
while typesetting the exercises, things are working fine.

I call this a not-so-pretty-way because I am not able to typeset both a
chapter and an exercise section at the same time. In the end, I'll be
able to typeset all the chapters at once and then all the exercises.

Is there a better way of doing this? Is there a package that is able to
change the width of a LaTeX document in the middle of it? I've searched
the Companion for it, but couldn't fine any.

TIA

Paulo

Donald Arseneau

unread,
Apr 4, 1999, 4:00:00 AM4/4/99
to
In article <1dpqaxc.1j2...@caaas2-p56.telepac.pt>, paul...@not.here.geocities.com (Paulo Abreu) writes...

>The book I'm working on has chapters with one column and wide margins
>for marginal notes. At the end of each chapter there are exercises that
>should be typeset with two columns and using the marginal note space.

Do the exercises start on a new page? I presume they do.

\newenvironment{exercises}{
\clearpage
\begingroup
\addtolength{\textwidth}{\marginparsep}
\addtolength{\textwidth}{\marginparwidth}
\addtolength{\evensidemargin}{-\marginparsep}
\addtolength{\evensidemargin}{-\marginparwidth}
\twocolumn[\section{Exercises}]
Or whatever formatting here.
}{
\clearpage
\endgroup
\onecolumn
}


Donald Arseneau as...@triumf.ca

Paulo Abreu

unread,
Apr 5, 1999, 3:00:00 AM4/5/99
to
Donald Arseneau <as...@reg.triumf.ca> wrote:

> Do the exercises start on a new page? I presume they do.

Yes, they do.

>
> \newenvironment{exercises}{
> \clearpage
> \begingroup
> \addtolength{\textwidth}{\marginparsep}
> \addtolength{\textwidth}{\marginparwidth}
> \addtolength{\evensidemargin}{-\marginparsep}
> \addtolength{\evensidemargin}{-\marginparwidth}
> \twocolumn[\section{Exercises}]
> Or whatever formatting here.
> }{
> \clearpage
> \endgroup
> \onecolumn
> }
>
>
> Donald Arseneau as...@triumf.ca

Thanks, this works fine. But it doesn't work with multicol.sty. I need
multicol because of the balancing cols on the last page. Any
suggestions?


Paulo
---
Remove the not.here. from my email.

Donald Arseneau

unread,
Apr 6, 1999, 3:00:00 AM4/6/99
to
In article <1dps3tw.1hfltpbd2fn40N@[194.65.249.232]>, paul...@not.here.geocities.com (Paulo Abreu) writes...

>Donald Arseneau <as...@reg.triumf.ca> wrote:
>Thanks, this works fine. But it doesn't work with multicol.sty. I need
>multicol because of the balancing cols on the last page. Any
>suggestions?

Use the multicols environment. I think you will still need a \onecolumn
command to apply the changed \textwidth settings.

\newenvironment{exercises}{
\clearpage
\begingroup
\addtolength{\textwidth}{\marginparsep}
\addtolength{\textwidth}{\marginparwidth}
\addtolength{\evensidemargin}{-\marginparsep}
\addtolength{\evensidemargin}{-\marginparwidth}

% \twocolumn[\section{Exercises}]
\onecolumn
\section{Exercises}
\begin{multicols}{2}
Or whatever formatting here.
}{
\end{multicols}
\clearpage
\endgroup
\onecolumn
}

(I didn't test this time.)

Donald Arseneau as...@triumf.ca

0 new messages