我正在制作一个非常简单的 TeX 文件。我用它在一页上放了很多注释;但是,要求我在第一个位置的右上角留出大约一英寸乘一英寸的边距(否则我的四边边距要小得多)。
我该如何实现这一点?理想情况下,它会保持原样 - 仅在第一页 - 并且当我对文件的其他部分进行更改/编辑字数统计等时不会改变。
以下是一些代码:
\documentclass[8pt, letter, twocolumn]{extarticle}
\usepackage[bottom=0.5cm, right=0.5cm, left=0.5cm, top=0.5cm]{geometry}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\begin{document}
Name and stuff
\section{something}
Long long sprawling thing that goes on for about 10 pages
\end{document}
答案1
重叠边距比设置它们更容易,尤其是非矩形的。这使用 tikzpicture 的覆盖选项(运行两次)。
\documentclass[8pt, letter, twocolumn]{extarticle}
\usepackage[bottom=0.5cm, right=0.5cm, left=0.5cm, top=0.5cm]{geometry}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\usepackage{tikz}
\begin{document}
Name and stuff
\begin{tikzpicture}[overlay,remember picture]% anywhere on the first page
\draw (current page.north east) rectangle ++(-1in,-1in);
\path (current page.north east) ++(-0.5in,-0.5in)
node{\parbox{0.9in}{\centering this is a test}};
\end{tikzpicture}
\section{something}
Long long sprawling thing that goes on for about 10 pages
\end{document}
此版本使用 LaTeX 钩子。
\documentclass[8pt, letter, twocolumn]{extarticle}
\usepackage[bottom=0.5cm, right=0.5cm, left=0.5cm, top=0.5cm]{geometry}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\AddToHookNext{shipout/background}{\put (\dimexpr \paperwidth-1in\relax,-0.5in) {%
\dimen0=\dimexpr 1in-2\fboxsep-2\fboxrule\relax
\fbox{\parbox[c][\dimen0][c]{\dimen0}{\centering
this is a test}}}}
\begin{document}
Name and stuff
\section{something}
Long long sprawling thing that goes on for about 10 pages
\end{document}
这使用 flowfram 来创建不规则边距。frowfram 的问题在于段落在两个框架之间的边界处不会改变宽度。
\documentclass[8pt, letter, twocolumn]{extarticle}
\usepackage[bottom=0.5cm, right=0.5cm, left=0.5cm, top=0.5cm]{geometry}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\usepackage{flowfram}
\newflowframe[1]{\dimexpr \textwidth+0.5cm-1in}% width
{\dimexpr 1in-0.5cm}% height
{0pt}% left edge
{\dimexpr \textheight+0.5cm-1in}% bottom
\newflowframe[1]{\textwidth}% width
{\dimexpr \textheight+0.5cm-1in}% height
{0pt}{0pt}
\usepackage{lipsum}% random text
\begin{document}
\lipsum[1-2]
\section{something}
Long long sprawling thing that goes on for about 10 pages
\end{document}