LaTeX で作成した A4 用紙を水平に 3 つに折ります。テキストの下に、端から端まで 2 本の灰色の破線 (透かしのようなもの) を入れたいと思っています。これは可能ですか?
(ページの最後の 3 分の 1 には住所が含まれ、最初の 3 分の 2 にはメッセージが表示されます。したがって、境界線のあるミニページは完璧な解決策ではありません。)
答え1
eso-pic
およびを含む短いコードdashrule
:
\documentclass[12pt, a4paper]{article}
\usepackage{ebgaramond}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{dashrule}
\usepackage{eso-pic}
\AddToShipoutPictureBG{\color{lightgray}%
\AtPageLowerLeft{\hdashrule[0.667\paperheight]{\paperwidth}{0.4pt}{6pt 3pt}}%
\AtPageLowerLeft{\hdashrule[0.333\paperheight]{\paperwidth}{0.4pt}{6pt 3pt}}}%
\begin{document}
\lipsum
\end{document}
答え2
\AddEverypageHook
これを次のように行う方法があります。すべてのページパッケージを使用してページにいくつかの行を追加しますティックZそしてTikZページノード基本的には、TikZページノード各ページの 3 分の 1 と 3 分の 2 の位置に水平線を引きます。
以下に、MWE によって作成されたページの一部を示します。
コードは次のとおりです:
\documentclass{article}
\usepackage{everypage}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\AddEverypageHook{%
\begin{tikzpicture}[remember picture,overlay]
\draw[gray!50,dashed]($(current page.north west)!0.33!(current page.south west)$)
--($(current page.north east)!0.33!(current page.south east)$);
\draw[gray!50,dashed]($(current page.north west)!0.66!(current page.south west)$)
--($(current page.north east)!0.66!(current page.south east)$);
\end{tikzpicture}
}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
個人的には、ページ全体に渡る線は少し気が散りすぎると思うので、代わりに次のようなものを選びます。
変更されたコードは次のとおりです。
\documentclass{article}
\usepackage{everypage}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\AddEverypageHook{%
\begin{tikzpicture}[remember picture,overlay]
\foreach \side/\offset/\pos in {west/1/0.33, west/1/0.66, east/-1/0.33, east/-1?0.66} {
\draw[gray!50, thin]($(current page.north \side)!\pos!(current page.south \side)$)--++(\offset,0);
}
\end{tikzpicture}
}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
答え3
eso-pic
提案されたような解決策@バーナード。
\documentclass[]{article}
\usepackage{eso-pic}
\usepackage[]{color}
\AddToShipoutPictureBG
{%
\textcolor{gray}
{%
\multiput
(0,\LenToUnit{\paperheight/3})
(\LenToUnit{0.02\paperwidth},0)
{50}
{\line(1,0){\LenToUnit{0.01\paperwidth}}}
\multiput
(0,\LenToUnit{2\paperheight/3})
(\LenToUnit{0.02\paperwidth},0)
{50}
{\line(1,0){\LenToUnit{0.01\paperwidth}}}
}
}
\usepackage{duckuments}
\begin{document}
\duckument
\end{document}