Compare commits

..

2 commits

Author SHA1 Message Date
Wolfgang 393ed36daf fix trainee detection 2024-11-30 18:42:52 +01:00
Wolfgang 262baee0a3 more config options and descriptions 2024-11-30 13:38:31 +01:00
2 changed files with 73 additions and 44 deletions

View file

@ -11,8 +11,9 @@ enumerated with the number as watermark.
See [sample pdf](../../../raw/branch/main/sample/logsheet.DL1XXXX.pdf) See [sample pdf](../../../raw/branch/main/sample/logsheet.DL1XXXX.pdf)
Your callsign can be a watermark across the background. If the sheet is for Your callsign can be a watermark across the background. Font size is calculated
trainee logging, there will be "Location+OP" in the heading. automatically. If the sheet is for trainee logging, there will be "Location+OP"
in the heading.
## Setup ## Setup
@ -28,12 +29,14 @@ Of course you can use your own method of using LaTeX.
* Config callsign via filename: * Config callsign via filename:
* logsheet.DL1XXXX.tex will use callsign DL1XXXX * logsheet.DL1XXXX.tex will use callsign DL1XXXX
* logsheet.DN1XXXX.trainee.tex will use callsign DN1XXXX and set Location+OP * logsheet.DN1XXXX.trainee.tex will use callsign DN1XXXX and set Location+OP
in heading (for trainee callsign) in heading (for trainee callsign)
* logsheet.DL1XXXX.tex will use callsign DL1XXXX/t and set Location+OP in * logsheet.DL1XXXX.tex will use callsign DL1XXXX/t and set Location+OP in
heading (for new (2024) german trainee callsign) heading (for new (2024) german trainee callsign)
* Configuration in the first section of logsheet.tex possible: * Configuration in the first section of logsheet.tex possible:
* paper format * paper format
* number of logging blocks on each page * number of blocks on each page
* number of pages
* page layout
## Build ## Build
With the build system: **make pdf** With the build system: **make pdf**

View file

@ -3,6 +3,9 @@
% can do whatever you want with this stuff. If we meet some day, and you think % can do whatever you want with this stuff. If we meet some day, and you think
% this stuff is worth it, you can buy me a beer in return. % this stuff is worth it, you can buy me a beer in return.
% needed because pgf also loads xcolor with different options
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[12pt]{article} \documentclass[12pt]{article}
% %
@ -13,17 +16,26 @@
\newlength{\rowheight} \newlength{\rowheight}
% configure height of lines % configure height of lines
\setlength{\rowheight}{9mm} \setlength{\rowheight}{9mm}
% configure number of tables on each page % configure number of table blocks on each page
\def\numtables{2} \def\numtables{2}
% margins of paper defined above % margins of paper defined above
\usepackage[\paper, hmargin=0.7cm, vmargin=0.9cm]{geometry} \usepackage[\paper, hmargin=0.7cm, vmargin=0.9cm]{geometry}
% layout of pages (with pgfmorepages)
% valid settings e. g. 2 on 1, 4 on 1, 6 on 1, 8 on 1, 16 on 1
\usepackage{pgfmorepages}
\pgfpagesuselayout{2 on 1}[\paper, landscape]
% how many pages (duplex printing with \pgflayout 2 on 1 can fit 4 pages
% but maybe more numerated pages are needed
% you may run out of memory for latex, maybe try lualatex
\def\numpages{4}
% define callsign here or with filename % define callsign here or with filename
% e. g. \def\callsign{AB1CD} % e. g. \def\callsign{AB1CD}
% if you define it here, callsign will not be taken from filename % if you define it here, callsign will not be taken from filename
\def\callsign{} \def\callsign{}
% is this for trainee logging? % is this for trainee logging?
% set \trainee to trainee for trainee callsign % set \trainee to trainee for trainee callsign
% or to traineestroke to get \callsign/T % or to stroketrainee to get \callsign/T
% if you define it here, trainee will not be taken from filename % if you define it here, trainee will not be taken from filename
\def\trainee{} \def\trainee{}
@ -56,21 +68,42 @@
\StrCut{\jobname}{.}\strA\strB \StrCut{\jobname}{.}\strA\strB
\StrLen{\callsign}[\lenTemp] \StrLen{\callsign}[\lenTemp]
\IfEq{\lenTemp}{0}{ \IfEq{\lenTemp}{0}{
\StrCut{\strB}{.}\callsign\strC \StrCut{\strB}{.}\callsign\strC
}{ }{
\StrCut{\strB}{.}\strTemp\strC \StrCut{\strB}{.}\strTemp\strC
} }
\newif\ifistrainee
% default is false
\istraineefalse
% add /t to callsign if filename is logsheet.CALLSIGN.stroketrainee.tex
% set istrainee to true if applicable
% strange things with detokenize needed with latex
\StrLen{\trainee}[\lenTemp] \StrLen{\trainee}[\lenTemp]
\IfEq{\lenTemp}{0}{ \IfEq{\lenTemp}{0}{
\StrCut{\strC}{.}\trainee\strD \StrCut{\strC}{.}\trainee\strD
}{} \IfStrEq{\trainee}{\detokenize{trainee}}{
\istraineetrue
%add /t to callsign if filename is logbool.CALLSIGN.traineestroke.tex }{
\IfStrEq{\trainee}{\detokenize{traineestroke}}{ \IfStrEq{\trainee}{\detokenize{stroketrainee}}{
\def\trainee{trainee} \istraineetrue
\edef\callsign{\callsign/T} \edef\callsign{\callsign/T}
}{}
}
}{
\IfStrEq{\trainee}{trainee}{
\istraineetrue
}{
\IfStrEq{\trainee}{stroketrainee}{
\istraineetrue
\edef\callsign{\callsign/T}
}{}
}
} }
% default scale if there is no callsign (\wmfontscale\paperwidth) % default scale if there is no callsign (\wmfontscale\paperwidth)
\FPset\wmfontscale{0.25} \FPset\wmfontscale{0.25}
@ -90,7 +123,7 @@
% pagenumber as watermark % pagenumber as watermark
\FPeval\wmfontscalepagenumber{0.75*wmfontscale} \FPeval\wmfontscalepagenumber{0.75*wmfontscale}
\usepackage[svgnames]{xcolor} \usepackage{xcolor}
\usepackage{eso-pic} \usepackage{eso-pic}
\usepackage{tikz} \usepackage{tikz}
\usetikzlibrary{calc} \usetikzlibrary{calc}
@ -113,10 +146,6 @@
} }
} }
% Duplicate page: e. g. two a5 on one a4
\usepackage{pgfmorepages}
\pgfpagesuselayout{2 on 1}[\paper,landscape]
\pagestyle{empty} \pagestyle{empty}
\setlength\parindent{0pt} \setlength\parindent{0pt}
@ -129,11 +158,11 @@
\FPeval\tablelinesPlusFour{round(tablelines + 4, 0)} \FPeval\tablelinesPlusFour{round(tablelines + 4, 0)}
% add +OP on trainee sheet % add +OP on trainee sheet
\IfStrEq{\trainee}{\detokenize{trainee}}{ \ifistrainee
\def\locationOp{Location+OP} \def\locationOp{Location+OP}
}{ \else
\def\locationOp{Location} \def\locationOp{Location}
} \fi
% add content of table, create #2 times #1/#2 rows, #1/#2 including two header rows % add content of table, create #2 times #1/#2 rows, #1/#2 including two header rows
\prgNewFunction \makerows{mm} { \prgNewFunction \makerows{mm} {
@ -166,29 +195,26 @@
\ttfamily \ttfamily
\SetTblrInner{rowsep=0pt,rulesep=0pt} \SetTblrInner{rowsep=0pt,rulesep=0pt}
% two sides (front/back) % two sides (front/back)
\foreach \i in {1,2} \foreach \i in {1,...,\numpages}
{ {
% two pages (left/right) \message{page \i}
\foreach \j in {1,2} % watermark on every page
{ \wmpagenumber
% watermark on every side \begin{center}
\wmpagenumber
\begin{center}
% fix centering % fix centering
\addtolength{\leftskip} {-2cm} \addtolength{\leftskip} {-2cm}
\addtolength{\rightskip}{-2cm} \addtolength{\rightskip}{-2cm}
\begin{tblr}[evaluate=\makerows]{ \begin{tblr}[evaluate=\makerows]{
rows={\rowheight}, rows={\rowheight},
width=\textwidth, width=\textwidth,
vline{1-Y}={}, vline{1-Y}={},
hline{2-Z}={}, hline{2-Z}={},
colspec={YYYYZ Q[colsep=0pt]} colspec={YYYYZ Q[colsep=0pt]}
} }
\makerows{\tablelines}{\numtables} \makerows{\tablelines}{\numtables}
\end{tblr} \end{tblr}
\end{center} \end{center}
\newpage \newpage
}
} }
\end{document} \end{document}