Latex - 仅更改几页的页边距

发布于 2024-08-09 19:30:03 字数 276 浏览 4 评论 0原文

我有一个 Latex 文档,我只需要更改几页(我添加大量图形的页面)的页边距。

特别是,我想更改上边距 (\voffset)。我尝试过这样做:

\addtolength{\voffset}{-4cm}

% Insert images here

\addtolength{\voffset}{4cm}

但没有成功。我已经看到了对几何包的引用,但我还没有找到如何将它用于一堆页面,而不是整个文档。

有什么提示吗?

I have a Latex document where I need to change the margins of only a few pages (the pages where I'm adding a lot of graphics).

In particular, I'd like to change the top margins (\voffset). I've tried doing:

\addtolength{\voffset}{-4cm}

% Insert images here

\addtolength{\voffset}{4cm}

but it didn't work. I've seen references to the geometry package, but I haven't found how to use it for a bunch of pages, and not for the whole document.

Any hints?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

遇到 2024-08-16 19:30:03

使用“geometry”包并在要更改边距的位置写入 \newgeometry{left=3cm,bottom=0.1cm} 。当你想重置边距时,你可以写\restoregeometry

Use the "geometry" package and write \newgeometry{left=3cm,bottom=0.1cm} where you want to change your margins. When you want to reset your margins, you write \restoregeometry.

遥远的她 2024-08-16 19:30:03

我在 beamer 中使用过它,但不适用于一般文档,但看起来这就是原始提示所建议的

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}

然后使用它,

\begin{changemargin}{-1cm}{-1cm}

不要忘记在

\end{changemargin}

页面末尾

我从中得到的 TeX FAQ 中的“即时”更改边距

I've used this in beamer, but not for general documents, but it looks like that's what the original hint suggests

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}

Then to use it

\begin{changemargin}{-1cm}{-1cm}

don't forget to

\end{changemargin}

at the end of the page

I got this from Changing margins “on the fly” in the TeX FAQ.

樱花细雨 2024-08-16 19:30:03

我在不同的解决方案上遇到了很多困难,包括页面顶部和底部的 \vspace{-Xmm} 以及处理警告和错误。最后我找到了这个答案:

您可以更改一页或多页的边距,然后将其恢复为默认值:

\usepackage{geometry}
...
... 
...
\newgeometry{top=5mm, bottom=10mm}     % use whatever margins you want for left, right, top and bottom.
...
... %<The contents of enlarged page(s)>
...    
\restoregeometry     %so it does not affect the rest of the pages.
...
... 
...

PS:

1-这还可以修复以下警告:

LaTeX 警告:对于输入行上的 ...pt 页面来说浮动太大...

2- 有关更详细的答案,请参阅

3-我刚刚发现这是对Kevin Chen的答案的更多阐述。

I was struggling a lot with different solutions including \vspace{-Xmm} on the top and bottom of the page and dealing with warnings and errors. Finally I found this answer:

You can change the margins of just one or more pages and then restore it to its default:

\usepackage{geometry}
...
... 
...
\newgeometry{top=5mm, bottom=10mm}     % use whatever margins you want for left, right, top and bottom.
...
... %<The contents of enlarged page(s)>
...    
\restoregeometry     %so it does not affect the rest of the pages.
...
... 
...

PS:

1- This can also fix the following warning:

LaTeX Warning: Float too large for page by ...pt on input line ...

2- For more detailed answer look at this.

3- I just found that this is more elaboration on Kevin Chen's answer.

§对你不离不弃 2024-08-16 19:30:03
\par\vfill\break % Break Last Page

\advance\vsize by 8cm % Advance page height
\advance\voffset by -4cm % Shift top margin
% Start big page
Some pictures
% End big page
\par\vfill\break % Break the page with different margins

\advance\vsize by -8cm % Return old margings and page height
\advance\voffset by 4cm % Return old margings and page height
\par\vfill\break % Break Last Page

\advance\vsize by 8cm % Advance page height
\advance\voffset by -4cm % Shift top margin
% Start big page
Some pictures
% End big page
\par\vfill\break % Break the page with different margins

\advance\vsize by -8cm % Return old margings and page height
\advance\voffset by 4cm % Return old margings and page height
新人笑 2024-08-16 19:30:03

对于数字,您可以使用此处描述的方法:
http://texblog.net/latex-archive/layout/centering-figure -表/
即,执行如下操作:

\begin{figure}[h]
\makebox[\textwidth]{%
        \includegraphics[width=1.5\linewidth]{bla.png}
    }
\end{figure}

请注意,如果图中有子图,您可能希望在框中进入段落模式,如下所示:

\begin{figure}[h]
\makebox[\textwidth]{\parbox{1.5\textwidth}{ %
\centering
\subfigure[]{\includegraphics[width=0.7\textwidth]{a.png}}
\subfigure[]{\includegraphics[width=0.7\textwidth]{b.png}}
\end{figure}

为了允许图在页面中居中,而不是突出到两个边距中不仅仅是右边距。
这通常可以解决图像问题。请注意,使用此方法,图像的标题仍将由页面的正常边距分隔(这是一件好事)。

For figures you can use the method described here :
http://texblog.net/latex-archive/layout/centering-figure-table/
namely, do something like this:

\begin{figure}[h]
\makebox[\textwidth]{%
        \includegraphics[width=1.5\linewidth]{bla.png}
    }
\end{figure}

Notice that if you have subfigures in the figure, you'll probably want to enter into paragraph mode inside the box, like so:

\begin{figure}[h]
\makebox[\textwidth]{\parbox{1.5\textwidth}{ %
\centering
\subfigure[]{\includegraphics[width=0.7\textwidth]{a.png}}
\subfigure[]{\includegraphics[width=0.7\textwidth]{b.png}}
\end{figure}

For allowing the figure to be centered in the page, protruding into both margins rather than only the right margin.
This usually does the trick for images. Notice that with this method, the caption of the image will still be in the delimited by the normal margins of the page (which is a good thing).

梦醒时光 2024-08-16 19:30:03

稍微修改以更改\ voffset 对我有用:

\newenvironment{changemargin}[1]{
  \begin{list}{}{
    \setlength{\voffset}{#1}
  }
  \item[]}{\end{list}}

然后将您的图形放入 \begin{changemargin}{-1cm}...\end{changemargin} 环境中。

A slight modification of this to change the \voffset works for me:

\newenvironment{changemargin}[1]{
  \begin{list}{}{
    \setlength{\voffset}{#1}
  }
  \item[]}{\end{list}}

And then put your figures in a \begin{changemargin}{-1cm}...\end{changemargin} environment.

甜尕妞 2024-08-16 19:30:03

我找不到设置单页边距的简单方法。

我的解决方案是使用 vspace 和我想要的空白空间的厘米数:

 \vspace*{5cm}                                                             

我将此命令放在我想要有 +5cm 边距的页面的开头。

I could not find a easy way to set the margin for a single page.

My solution was to use vspace with the number of centimeters of empty space I wanted:

 \vspace*{5cm}                                                             

I put this command at the beginning of the pages that I wanted to have +5cm of margin.

夜访吸血鬼 2024-08-16 19:30:03

在一些 LaTeX 参考中查找 \enlargethispage

Look up \enlargethispage in some LaTeX reference.

羁拥 2024-08-16 19:30:03

这对我有用:

\newpage % larger page1
\enlargethispage{1.5cm} % more room for text or floats
\advance\voffset by -0.5cm % reduce top margin
\advance\footskip by 1cm % lower page number
    
Some content

\newpage % larger page2
\enlargethispage{1.5cm}
    
Some content

...

\newpage % return to normal page
\advance\voffset by 0.5cm
\advance\footskip by -1cm

This worked for me:

\newpage % larger page1
\enlargethispage{1.5cm} % more room for text or floats
\advance\voffset by -0.5cm % reduce top margin
\advance\footskip by 1cm % lower page number
    
Some content

\newpage % larger page2
\enlargethispage{1.5cm}
    
Some content

...

\newpage % return to normal page
\advance\voffset by 0.5cm
\advance\footskip by -1cm
等你爱我 2024-08-16 19:30:03

我在投影仪演示中遇到了同样的问题。对我来说,使用 columns 环境工作:

\begin{frame}
  \begin{columns}
    \column{1.2\textwidth}
    \begin{figure}
      \subfigure{\includegraphics[width=.49\textwidth]{1.png}}
      \subfigure{\includegraphics[width=.49\textwidth]{2.png}}
    \end{figure}
   \end{columns}
\end{frame}

I had the same problem in a beamer presentation. For me worked using the columns environment:

\begin{frame}
  \begin{columns}
    \column{1.2\textwidth}
    \begin{figure}
      \subfigure{\includegraphics[width=.49\textwidth]{1.png}}
      \subfigure{\includegraphics[width=.49\textwidth]{2.png}}
    \end{figure}
   \end{columns}
\end{frame}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文