| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2014 by Henry Menke <[email protected]> |
| 4 |
% Copyright (C) 2019 by Benjamin Berg <[email protected]> |
| 5 |
% |
| 6 |
% This work may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 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 |
% |
| 12 |
% This work has the LPPL maintenance status `maintained'. |
| 13 |
% |
| 14 |
% The Current Maintainer of this work is Benjamin Berg. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\ProvidesFile{sdapspdf.dtx} |
| 21 |
%</driver> |
| 22 |
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 23 |
%<package>\ProvidesPackage{sdapspdf} |
| 24 |
%<*package> |
| 25 |
[2015/04/10 v0.1 Initial version of SDAPS pdf package] |
| 26 |
%</package> |
| 27 |
% |
| 28 |
%<*driver> |
| 29 |
\documentclass{ltxdoc} |
| 30 |
\usepackage{sdapspdf}[2015/04/10] |
| 31 |
%\EnableCrossrefs |
| 32 |
\CodelineIndex |
| 33 |
\RecordChanges |
| 34 |
\begin{document} |
| 35 |
\DocInput{sdapspdf.dtx} |
| 36 |
\end{document} |
| 37 |
%</driver> |
| 38 |
% \fi |
| 39 |
% |
| 40 |
% \CheckSum{0} |
| 41 |
% |
| 42 |
% \CharacterTable |
| 43 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 44 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 45 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 46 |
% Exclamation \! Double quote \" Hash (number) \# |
| 47 |
% Dollar \$ Percent \% Ampersand \& |
| 48 |
% Acute accent \' Left paren \( Right paren \) |
| 49 |
% Asterisk \* Plus \+ Comma \, |
| 50 |
% Minus \- Point \. Solidus \/ |
| 51 |
% Colon \: Semicolon \; Less than \< |
| 52 |
% Equals \= Greater than \> Question mark \? |
| 53 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 54 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 55 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 56 |
% Right brace \} Tilde \~} |
| 57 |
% |
| 58 |
% |
| 59 |
% \changes{v0.1}{2015/01/14}{Initial version} |
| 60 |
% |
| 61 |
% \GetFileInfo{sdapspdf.dtx} |
| 62 |
% |
| 63 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 64 |
% |
| 65 |
% |
| 66 |
% \title{The \textsf{sdapspdf} package\thanks{This document |
| 67 |
% corresponds to \textsf{sdapspdf}~\fileversion, dated \filedate.}} |
| 68 |
% \author{Benjamin Berg \\ \texttt{[email protected]}} |
| 69 |
% |
| 70 |
% \maketitle |
| 71 |
% |
| 72 |
% \section{Documentation} |
| 73 |
% |
| 74 |
% Please refer to \url{https://sdaps.org/class-doc} for documentation. |
| 75 |
% |
| 76 |
% \StopEventually{\PrintChanges\PrintIndex} |
| 77 |
% |
| 78 |
% \section{Implementation} |
| 79 |
% |
| 80 |
% This package uses the \LaTeX3 language internally, so we need to enable it. |
| 81 |
% \begin{macrocode} |
| 82 |
% We need at least 2011-08-23 for \keys_set_known:nnN |
| 83 |
\RequirePackage{expl3}[2011/08/23] |
| 84 |
%\RequirePackage{xparse} |
| 85 |
\ExplSyntaxOn |
| 86 |
% \end{macrocode} |
| 87 |
% |
| 88 |
% And we need a number of other packages. |
| 89 |
% \begin{macrocode} |
| 90 |
\ExplSyntaxOff |
| 91 |
|
| 92 |
\RequirePackage{sdapsbase} |
| 93 |
\RequirePackage{hyperref} |
| 94 |
|
| 95 |
|
| 96 |
\ExplSyntaxOn |
| 97 |
|
| 98 |
% \end{macrocode} |
| 99 |
% |
| 100 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 101 |
% |
| 102 |
% \subsection{PDF Support} |
| 103 |
% |
| 104 |
% This package adds basic overlays to SDAPS boxes so that they become editable. |
| 105 |
% It is also possible to pre-fill them using overrides or the normal mechanism |
| 106 |
% to set variables for box drawing. |
| 107 |
% |
| 108 |
% \begin{macrocode} |
| 109 |
|
| 110 |
|
| 111 |
\bool_new:N \l__sdaps_pdf_form_bool |
| 112 |
\bool_new:N \l__sdaps_pdf_checkbox_default_bool |
| 113 |
\tl_new:N \l__sdaps_pdf_checkboxsymbol_tl |
| 114 |
|
| 115 |
\keys_define:nn { sdaps / checkbox / overlay / pdfform } |
| 116 |
{ |
| 117 |
pdf_form .bool_set:N = \l__sdaps_pdf_form_bool, |
| 118 |
pdf_form .initial:n = false, |
| 119 |
|
| 120 |
default .bool_set:N = \l__sdaps_pdf_checkbox_default_bool, |
| 121 |
default .initial:n = false, |
| 122 |
|
| 123 |
checkboxsymbol .tl_set:N = \l__sdaps_pdf_checkboxsymbol_tl, |
| 124 |
checkboxsymbol .initial:n = 8, |
| 125 |
} |
| 126 |
|
| 127 |
\cs_new_protected_nopar:Nn \_sdaps_pdf_overlay_checkbox_form: |
| 128 |
{ |
| 129 |
\keys_set_known:nV { sdaps / checkbox / overlay / pdfform } \l_sdaps_parse_unknown_tl % |
| 130 |
|
| 131 |
\bool_if:NT \l__sdaps_pdf_form_bool { |
| 132 |
\node[anchor=center,inner~sep=0pt,outer~sep=0pt] at ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5*(\l_sdaps_width_dim, -\l_sdaps_height_dim)$) { |
| 133 |
\CheckBox[name=\l_sdaps_var_tl,bordersep=0,borderwidth=0pt,checkboxsymbol=\l__sdaps_pdf_checkboxsymbol_tl,bordercolor=,backgroundcolor=,checked=\bool_if:nTF\l__sdaps_pdf_checkbox_default_bool{true}{false},height=\l_sdaps_checkbox_height_dim,width=\l_sdaps_checkbox_width_dim]{\ignorespaces} |
| 134 |
}; |
| 135 |
} |
| 136 |
} |
| 137 |
\seq_put_left:Nn \g__sdaps_checkbox_overlays_seq \_sdaps_pdf_overlay_checkbox_form: |
| 138 |
|
| 139 |
|
| 140 |
\cs_new_protected_nopar:Nn \_sdaps_pdf_overlay_text_form: |
| 141 |
{ |
| 142 |
\keys_set_known:nV { sdaps / checkbox / overlay / pdfform } \l_sdaps_parse_unknown_tl % |
| 143 |
|
| 144 |
\bool_if:NT \l__sdaps_pdf_form_bool { |
| 145 |
\node[anchor=center,inner~sep=2pt,outer~sep=0pt] at ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5*(\l_sdaps_width_dim, -\l_sdaps_height_dim)$) { |
| 146 |
\dim_set:Nn \l_sdaps_width_dim { \l_sdaps_width_dim - 4pt } |
| 147 |
\dim_set:Nn \l_sdaps_height_dim { \l_sdaps_height_dim - 4pt } |
| 148 |
|
| 149 |
\TextField[name=\l_sdaps_var_tl,bordersep=0pt,borderwidth=0pt,bordercolor=,backgroundcolor=,multiline=true,height=\l_sdaps_height_dim,width=\l_sdaps_width_dim]{\ignorespaces} |
| 150 |
}; |
| 151 |
} |
| 152 |
} |
| 153 |
\seq_put_left:Nn \g__sdaps_textbox_overlays_seq \_sdaps_pdf_overlay_text_form: |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
\ExplSyntaxOff |
| 158 |
|
| 159 |
% |
| 160 |
% \end{macrocode} |
| 161 |
% |
| 162 |
|
| 163 |
% \Finale |
| 164 |
\endinput |