![TiKZ-图片适合页面边缘](https://linux22.com/image/251823/TiKZ-%E5%9B%BE%E7%89%87%E9%80%82%E5%90%88%E9%A1%B5%E9%9D%A2%E8%BE%B9%E7%BC%98.png)
答案1
这个怎么样,它利用了马丁·沙勒的回答这个答案:
\documentclass[10pt]{scrartcl}
\usepackage[margin=20mm,a6paper]{geometry}
\usepackage{tikz}
\usepackage{xifthen}
\usetikzlibrary{fit,calc}
\usepackage{lipsum}
\usepackage{everypage}
\parindent0mm
\newcommand{\currentsidemargin}{%
\ifodd\value{page}%
\oddsidemargin%
\else%
\evensidemargin%
\fi%
}
\AddEverypageHook{%
\ifthenelse{\isodd{\thepage}}
{ \begin{tikzpicture}[overlay, remember picture]
\path (current page.north west) ++(\hoffset, -\voffset) node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\paperwidth, minimum height=\paperheight] (pagearea) {};
\path (pagearea.north west) ++(1in+\currentsidemargin,-1in-\topmargin-\headheight-\headsep) node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\textwidth, minimum height=\textheight] (textarea) {};
\node[inner sep=0,fit=(pagearea.north east)(textarea.north east)(pagearea.south east)] (marginbox) {};
\draw (marginbox.south east) rectangle (marginbox.north west);
\draw (marginbox.south east) -- (marginbox.north west);
\end{tikzpicture}
}{}
}
\begin{document}
\lipsum[1-10]
\end{document}
答案2
我不太明白这个问题,但你可以相当直白地制作你的页面,然后通过例如将它们组合起来我可以将 16 页的 pdf 转换为 LaTeX 中的 8x2 矩阵吗?
对于多页文件,你可以使用类似
\documentclass{article}
\usepackage[paperheight=148mm,paperwidth=105mm]{geometry}
\usepackage{tikz,lipsum}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=5mm,red!20]
([shift={(-0.5\pgflinewidth,-0.5\pgflinewidth)}]current page.north east)
rectangle
([shift={(0.5\pgflinewidth,0.5\pgflinewidth)}]current page.south west);
\node[scale=3,opacity=0.2,rotate=60] at (current page.center) {\textsf{First Watermark}};
\end{tikzpicture}
\lipsum[2]
\newpage
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=5mm,blue!20]
([shift={(-0.5\pgflinewidth,-0.5\pgflinewidth)}]current page.north east)
rectangle
([shift={(0.5\pgflinewidth,0.5\pgflinewidth)}]current page.south west);
\end{tikzpicture}
\lipsum[3]
\end{document}
请注意,您必须运行两次才能remember picture,overlay
正常工作。
编辑仅限页面侧面,
\documentclass{article}
\usepackage[paperheight=148mm,paperwidth=105mm]{geometry}
\usepackage{tikz,lipsum}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=5mm,blue!20]
([shift={(-0.5\pgflinewidth,\pgflinewidth)}]current page.north east)
--
([shift={(-0.5\pgflinewidth,0)}]current page.south east) node[circle,anchor=east,pos=0.2,fill,draw,text=black] {\Large $\Gamma$};
\end{tikzpicture}
\lipsum[3]
\end{document}