Debian Codegraph @

texmf-dist/tex/latex/eso-pic/showframe.sty

raw
1
2 % Rolf Niepraschk -- [email protected]
3
4 % showframe.sty
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2003/12/01 or later.
13 %
14 % This work has the LPPL maintenance status "author-maintained".
15
16 % Draws visible frames for the text and margin area, and lines
17 % for the head and foot to check layout in detail. Using the package
18 % option "noframe" you can draw the frames later only for a single
19 % page with \AddToShipoutPicture*{\ShowFramePicture}. Another useful
20 % options maybe eso-pic's "colorgrid", "grid" and "texcoord".
21 %
22 % \ShowFrameColor and \ShowFrameLinethickness can be used to change
23 % the frames.
24
25 \ProvidesPackage{showframe}[2020/10/14 v0.1j showframe (new impl., RN)]
26
27 \newif\ifSF@frame\SF@frametrue
28
29 \DeclareOption{noframe}{\SF@framefalse}
30 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{eso-pic}}
31 \ProcessOptions\relax
32
33 \RequirePackage{eso-pic}[2002/10/30]
34
35 \newcommand*\ShowFrameColor{\normalcolor}
36 \newcommand*\ShowFrameLinethickness{.8pt}
37 \newdimen\SF@tempdima
38
39 \newcommand\ShowFramePicture{%
40 \begingroup
41 \ShowFrameColor\linethickness{\ShowFrameLinethickness}%
42 \AtPageLowerLeft{%
43 \framebox(\paperwidth,\paperheight){}}%
44 \AtTextLowerLeft{%
45 \framebox(\textwidth,\textheight){}}%
46 \AtTextUpperLeft{%
47 \put(0,\headsep){%
48 \framebox(\textwidth,\headheight){}}}%
49 \AtTextLowerLeft{%
50 \put(0,-\footskip){%
51 \line(1,0){\textwidth}}}%
52 \AtTextLowerLeft{%
53 \SF@tempdima=\textwidth\advance\SF@tempdima\marginparsep%
54 \if@twoside
55 \ifodd\c@page\else
56 \if@mparswitch
57 \SF@tempdima=-\marginparsep\advance\SF@tempdima-\marginparwidth
58 \fi
59 \fi
60 \fi
61 \put(\SF@tempdima,0)%
62 {\framebox(\marginparwidth,\textheight){}}%
63 }%
64 \endgroup
65 }
66
67 \ifSF@frame\AddToShipoutPictureFG{\ShowFramePicture}\fi
68
69 \endinput