Note that there are some explanatory texts on larger screens.

plurals
  1. POheader width on the last page of the chapter
    text
    copied!<p>I'm trying to turn off marginpar when starting a new multicols environment with this new environment, which uses the multicols and chngpage packages:</p> <pre><code>\newenvironment{multi}[1]{% \newlength{\newtextwidth}% \setlength{\newtextwidth}{\marginparwidth}% \addtolength{\newtextwidth}{-1cm}% \addtolength{\headheight}{.5cm}% \let\oldheadrule\headrule% \addtolength{\headwidth}{\newtextwidth}% \begin{adjustwidth}{}{-\newtextwidth}\begin{multicols}{#1}}% {\end{multicols}\end{adjustwidth}} </code></pre> <p>Which works great: <a href="http://img6.imageshack.us/img6/6757/screenshotewa.png" rel="nofollow noreferrer">latex header http://img6.imageshack.us/img6/6757/screenshotewa.png</a></p> <p>Uhm, almost, since on the last page of the current chapter "Lorem ipsum" it behaves like I hadn't instruct it to: \addtolength{\headwidth}{\newtextwidth}: <a href="http://img11.imageshack.us/img11/6072/screenshotwbd.png" rel="nofollow noreferrer">latex header at the end of the chapter http://img11.imageshack.us/img11/6072/screenshotwbd.png</a></p> <p>How could I fix that?</p> <p><strong>Edit</strong>:</p> <p>I'm also using fancyhdr.</p> <p><strong>2nd Edit</strong>:</p> <p>A PoC:</p> <pre><code>\documentclass[12pt,a4paper,oneside]{report} \usepackage[utf8]{inputenc} \usepackage[top=2cm,left=2cm,right=4.5cm]{geometry} \usepackage{chngpage} \usepackage{color} \usepackage{amsmath} \usepackage[pdftex,bookmarks,pdfpagemode=UseOutlines,bookmarksopen,backref ,colorlinks,urlcolor=blue,linktocpage]{hyperref} \usepackage{url} \usepackage{amssymb} \usepackage{lipsum} \usepackage{fancyhdr} \usepackage{multicol} \usepackage{indentfirst} \usepackage{listings} \usepackage{boxedminipage} \pagestyle{fancy} \setlength{\columnseprule}{1pt} \setlength{\marginparwidth}{4cm} \rhead{\large\leftmark} \renewcommand{\chaptermark}[1]{% \markboth{#1}{}} \makeatletter \renewcommand*\@makechapterhead[1]{% {\parindent \z@ \raggedright \normalfont \huge\bfseries #1\par\nobreak \vskip 20\p@ }} \makeatother \let\oldmarginpar\marginpar \renewcommand\marginpar[1]{\-\oldmarginpar[\sffamily\raggedleft\footnotesize #1]% {\sffamily\raggedright\footnotesize \begin{boxedminipage}{\marginparwidth}#1\end{boxedminipage} }} \newenvironment{multi}[1]{% \newlength{\newtextwidth}% \setlength{\newtextwidth}{\marginparwidth}% \addtolength{\newtextwidth}{-1cm}% \addtolength{\headheight}{.5cm}% \let\oldheadrule\headrule% \addtolength{\headwidth}{\newtextwidth}% \begin{adjustwidth}{}{-\newtextwidth}\begin{multicols}{#1}}% {\end{multicols}\end{adjustwidth}} \begin{document} \tableofcontents \chapter{Lorem ipsum} \begin{multi}{2} \lipsum[1-20] \end{multi} \chapter{Lorem ipsum} \begin{multi}{2} \lipsum[1-20] \end{multi} \chapter{Lorem ipsum} \begin{multi}{2} \lipsum[1-20] \end{multi} \end{document} </code></pre> <p>It should be possible to continue single-column on the same page, after "multi", but the headers must be kept like when the page was started within the "multi" environment.</p> <p>Why would I need single-column after multi-column on the same page with a marginpar? Imagine presenting the source code for the article, with small hints on the margin. (That's what the listing package is there for)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload