【问题标题】:Latex - Change margins of only a few pagesLatex - 仅更改几页的边距
【发布时间】:2009-11-03 22:10:51
【问题描述】:

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

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

\addtolength{\voffset}{-4cm}

% Insert images here

\addtolength{\voffset}{4cm}

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

有什么提示吗?

【问题讨论】:

    标签: latex


    【解决方案1】:

    使用“几何”包并在您想要更改边距的地方写上\newgeometry{left=3cm,bottom=0.1cm}。当你想重置你的边距时,你写\restoregeometry

    【讨论】:

    • 谢谢你这完美的作品。我发现查看文档很有帮助,因为除了左侧、右侧、顶部和底部之外还有很多其他边距选项:sharelatex.com/learn/Page_size_and_margins
    • geometry 命令的唯一问题是,如果在页面中间使用,它们会将文本刷新到下一页,因为几何是为“页面”定义的。
    • @Emadpres 因为您想为某些页面定义新的边距,所以\newpage\pagebreak 是您首先使用的必要且自然的命令。
    • 如果我尝试使用 \geometry lyx 说“未定义的控制序列”,我该如何安装几何包?编辑:所有需要做的就是将 \usepackage{geometry} 插入到文档序言中,就像后一个答案指定的那样。
    • @MiikaVuorio,你解决了这个问题吗?看来是需要把geometry包更新到版本5了,但是没帮我解决?
    【解决方案2】:

    我在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 常见问题解答中的 Changing margins “on the fly” 得到这个。

    【讨论】:

    • 这对我来说比使用几何更好,因为在序言中包含几何包已经破坏了我需要使用的样式的布局。
    • 非常感谢!
    • 适用于图片的文本,请参阅下面的stackoverflow.com/questions/1670463/…答案
    【解决方案3】:

    我在不同的解决方案上苦苦挣扎,包括页面顶部和底部的 \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 警告:Float too large for page by ...pt on input line ...

    2- 如需更详细的答案,请查看this

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

    【讨论】:

    • 惊人的 - 这就像一个魅力
    【解决方案4】:
    \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
    

    【讨论】:

      【解决方案5】:

      对于数字,您可以使用此处描述的方法:
      http://texblog.net/latex-archive/layout/centering-figure-table/
      即,做这样的事情:

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

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

      【讨论】:

        【解决方案6】:

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

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

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

        【讨论】:

          【解决方案7】:

          在一些 LaTeX 参考中查找 \enlargethispage

          【讨论】:

          • 您能否在答案中添加更多详细信息,包括解决方案?
          【解决方案8】:

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

          我的解决方案是将 vspace 与我想要的厘米数的空白空间一起使用:

           \vspace*{5cm}                                                             
          

          我把这个命令放在我希望有 +5cm 边距的页面的开头。

          【讨论】:

          • 不知道是谁在没有评论的情况下投了反对票。这对我来说是救命稻草!
          【解决方案9】:

          我在投影仪演示中遇到了同样的问题。对我来说,使用 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}
          

          【讨论】:

            猜你喜欢
            • 2020-10-29
            • 2011-03-08
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-01-11
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多