本章最后一页的页眉宽度 [英] header width on the last page of the chapter

查看:126
本文介绍了本章最后一页的页眉宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试使用multicols和chngpage软件包的新环境启动新的multicols环境时,我正在尝试关闭marginpar:

I'm trying to turn off marginpar when starting a new multicols environment with this new environment, which uses the multicols and chngpage packages:

\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}}

哪些作品很棒: 乳胶标头http://img6.imageshack.us/img6/6757/screenshotewa.png

几乎,嗯,因为在当前章节"Lorem ipsum"的最后一页上,它的行为就像我没有指示它执行以下操作:\ addtolength {\ headwidth} {\ newtextwidth}: 本章末尾的胶乳标头http://img11.imageshack.us/img11/6072/screenshotwbd.png

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}: latex header at the end of the chapter http://img11.imageshack.us/img11/6072/screenshotwbd.png

我该如何解决?

修改:

我也在使用fancyhdr.

I'm also using fancyhdr.

第二次修改:

PoC:

\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}

应该可以在多"之后的同一页上继续单列,但是标题必须像在多"环境中启动页面时一样保留.

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.

为什么在同一页上使用marginpar在多列之后需要单列?想象一下,提供本文的源代码,并在边缘留出一些小提示. (这就是列表包的用途)

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)

推荐答案

我怀疑您的文本在制作完multicol框之后才构造了最后一个标题框,因此您不在更改范围之内.它回到了原来的值.

I suspect your last heading box is being constructed after your text finishes making the multicol boxes, so you're out of the scope of your change. It goes back to the old value.

您最好添加 fancyhdr 打包并使用它.我相信它在多列中表现良好.

You'd probably do well to add the fancyhdr package and use it. I believe it's well-behaved in multicolumn.

好吧,所以几乎可以肯定范围是事情.您正在新的multi环境中进行adjustwidth.当您的文本在多环境中用完时,您还没有填完最后一页;在页面填满之前,不会设置标题.因此,您的mutlti环境完成了该框,离开了作用域,然后页面完成并发出了.使用旧的宽度.

Okay, so it's almost certainly the scope thing. You're doing the adjustwidth in your new multi environment. When your text runs out in the multi envirnment, you haven't filled the last page; headers aren't set up until the page is filled. So your mutlti environment finishes the box, you leave the scope, and THEN the page is finished and emitted. Using the old width.

在环境外部设置标题宽度和参数.

Set the header width and parameters outside the environment.

这篇关于本章最后一页的页眉宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆