summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/projlib/PJLpaper.sty
blob: 67f105ba34f1b744148388c08d904d32dae64405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%%
%% This is file `PJLpaper.sty',
%% generated with the docstrip utility.

%% Copyright (C) 2021 by Jinwen XU
%% 
%% This is part of the ProjLib Toolkit.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\ProvidesPackage{PJLpaper}
    [2021/08/19 Paper style configuration]
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\RequirePackage{ifthen}

\SetupKeyvalOptions{%
    family = @PJLpaper,
    prefix = @PJLpaper@,
    setkeys=\kvsetkeys
}

\DeclareStringOption[normal]{paperstyle}
\DeclareVoidOption{yellowpaper}{\kvsetkeys{@PJLpaper}{paperstyle=yellow}}
\DeclareVoidOption{darkpaper}{\kvsetkeys{@PJLpaper}{paperstyle=dark}}
\DeclareVoidOption{nordpaper}{\kvsetkeys{@PJLpaper}{paperstyle=nord}}
\DeclareBoolOption[false]{preview}
\ProcessKeyvalOptions*\relax

%%================================
%% Preview mode
%%================================
\ifdefined\PJLnoPreview\else%
    \if@PJLpaper@preview%
        \RequirePackage{calc}
        \AtEndPreamble{%
        \setlength{\paperwidth}{\textwidth*\real{1.05}}%
        \setlength{\paperheight}{%
        (\textheight+\headheight+\headsep+\footskip)*\real{1.05}}%
        \setlength{\oddsidemargin}{(\paperwidth-\textwidth)/2-1in}%
        \setlength{\evensidemargin}{(\paperwidth-\textwidth)/2-1in}%
        \setlength{\topmargin}{(\paperheight-\textheight-\headheight-\headsep-\footskip)/2- 1in}%
        }
    \fi
\fi

%%================================
%% Paper color
%%================================
\RequirePackage{xcolor}
\definecolor{paper}{RGB}{255,255,255}
\definecolor{maintext}{RGB}{0,0,0}

\ifthenelse{\equal{\@PJLpaper@paperstyle}{yellow}}
{
    \definecolor{paper}{RGB}{247,246,233}
}
{\relax}

\ifthenelse{\equal{\@PJLpaper@paperstyle}{dark}}
{
    \definecolor{paper}{RGB}{30,30,30}
    \definecolor{maintext}{RGB}{207,207,207}
}
{\relax}

\ifthenelse{\equal{\@PJLpaper@paperstyle}{nord}}
{
    \definecolor{paper}{RGB}{46,52,64}
    \definecolor{maintext}{RGB}{214,220,230}
}
{\relax}

\newcommand{\PJLglobalcolor}[1]{%
    \color{#1}\global\let\default@color\current@color
}

\pagecolor{paper}
\PJLglobalcolor{maintext}
\AtEndPreamble{
\ifdefined\tcbset%
    \tcbset{colupper=maintext,collower=maintext}
\fi
}

\endinput
%%
%% End of file `PJLpaper.sty'.