![如何为偶数页和奇数页设置不同的边距(不镜像)?](https://linux22.com/image/473109/%E5%A6%82%E4%BD%95%E4%B8%BA%E5%81%B6%E6%95%B0%E9%A1%B5%E5%92%8C%E5%A5%87%E6%95%B0%E9%A1%B5%E8%AE%BE%E7%BD%AE%E4%B8%8D%E5%90%8C%E7%9A%84%E8%BE%B9%E8%B7%9D%EF%BC%88%E4%B8%8D%E9%95%9C%E5%83%8F%EF%BC%89%EF%BC%9F.png)
答案1
您必须手动分页,因为如果某个段落超出一页,则延续到下一页的部分的行长将是错误的。
\documentclass[a4paper]{article}
\usepackage{lipsum}
\newcommand\evenpage{%
\clearpage
\setlength\oddsidemargin{\dimexpr2cm-1in}%
\setlength\textwidth{\dimexpr\paperwidth-4cm}%
\setlength\columnwidth{\textwidth}%
\setlength\linewidth{\columnwidth}%
\setlength\hsize{\linewidth}%
\clearpage}
\newcommand\oddpage{%
\clearpage
\setlength\oddsidemargin{\dimexpr2cm-1in}%
\setlength\textwidth{\dimexpr\paperwidth-7.8cm}%
\setlength\columnwidth{\textwidth}%
\setlength\linewidth{\columnwidth}%
\setlength\hsize{\linewidth}%
\clearpage}
\begin{document}
\evenpage
\section{Hmmm}
XXX\dotfill XXX
XXX\dotfill XXX
\lipsum
\oddpage
\section{Hmmm}
XXX\dotfill XXX
XXX\dotfill XXX
\lipsum[1-5]
XXX\dotfill XXX
\evenpage
\section{Hmmm}
XXX\dotfill XXX
XXX\dotfill XXX
\lipsum
\oddpage
\section{Hmmm}
XXX\dotfill XXX
XXX\dotfill XXX
\lipsum[1-5]
XXX\dotfill XXX
\end{document}
答案2
这是一个流程框架解决方案。带星号的版本在流程框架周围画线。请注意使用 来\nopar
手动拆分段落。
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{flowfram}
\usepackage{lipsum}% random text
\newflowframe*[odd]{\textwidth}{\textheight}{0pt}{0pt}
\newflowframe*[even]{\dimexpr \textwidth-3.8cm}%
{\dimexpr \textheight-1cm}{0pt}{1cm}
\newcommand{\nopar}{{\parfillskip=0pt\par}\pagebreak\noindent}
\begin{document}
\lipsum[1-8]
Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio, nec commodo wisi enim eget quam. Quisque
libero justo, consectetuer a, feugiat vitae, porttitor eu, libero. Suspendisse sed mauris vitae elit sollicitudin
malesuada. Maecenas ultricies eros sit amet ante. Ut venenatis velit. Maecenas sed mi eget dui varius euismod.
Phasellus aliquet volutpat odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
Curae; Pellentesque sit amet pede ac sem eleifend consectetuer. Nullam elementum, urna vel imperdiet sodales,
elit ipsum pharetra ligula, ac pretium ante justo a nulla. Curabitur tristique arcu eu metus. Vestibulum lectus.
Proin mauris. Proin eu nunc eu urna hendrerit faucibus. Aliquam auctor, pede consequat laoreet varius, eros tellus
\nopar
scelerisque quam, pellentesque hendrerit ipsum dolor sed augue. Nulla nec lacus.
\lipsum[10-16]
Curabitur tellus magna, porttitor a, commodo a, commodo in, tortor. Donec interdum.
Praesent scelerisque. Maecenas posuere sodales odio. Vivamus metus lacus, varius
quis, imperdiet quis, rhoncus a, turpis. Etiam ligula arcu, elementum a, venenatis quis,
sollicitudin sed, metus. Donec nunc pede, tincidunt in, venenatis vitae, faucibus vel, nibh.
\nopar
Pellentesque wisi. Nullam malesuada. Morbi ut tellus ut pede tincidunt porta. Lorem
ipsum dolor sit amet, consectetuer adipiscing elit. Etiam congue neque id dolor.
\lipsum[18-20]
\end{document}