initial upload

This commit is contained in:
Wolfgang 2024-11-27 20:57:59 +01:00
parent c8b88987e6
commit 32d9ec65c1
5 changed files with 246 additions and 1 deletions

3
.gitignore vendored
View file

@ -301,3 +301,6 @@ TSWLatexianTemp*
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
Makefile
latex.mk
*.pdf

View file

@ -1,3 +1,40 @@
# logsheet-tex
Printable logsheet for amateur radio operators in tex
Printable logsheet for amateur radio operators in tex
## Description
With this latex file you can create a print template for an amateur radio
logsheet. By default you fold a DIN A4 paper in half and get four A5 papers in
portrait mode for the logsheet. These A5 sides are all enumerated with the
number as watermark.
Your callsign can be a watermark across the background. If the sheet is for
trainee logging, there will be "Location+OP" in the heading.
## Setup
### Prepare build system
* Download Makefile for typesetting LaTeX documents from
[https://github.com/tueda/makefile4latex/](https://github.com/tueda/makefile4latex/raw/refs/heads/master/Makefile)
Of course you can use your own method of using LaTeX.
### Config callsign/etc.
* Copy latex.mk.example to latex.mk and adapt it for generating different pdfs
* Config callsign via filename:
** logsheet.DL1XXXX.tex will use callsign DL1XXXX
** logsheet.DN1XXXX.trainee.tex will use callsign DN1XXXX and set Location+OP
in heading (for trainee callsign)
** logsheet.DL1XXXX.tex will use callsign DL1XXXX/t and set Location+OP in
heading (for new (2024) german trainee callsign)
* Configuration in the first section of logsheet.tex possible:
** paper format
** number of logging blocks on each page
## Build
With the build system: **make pdf**
Otherwise: build the .tex files as you like

11
latex.mk.example Normal file
View file

@ -0,0 +1,11 @@
PDF_FILES=logsheet.DL1XXXX.pdf logsheet.DN1XXXX.trainee.pdf logsheet.DL1XXXX.traineestroke.pdf
pdf: $(PDF_FILES)
$(MAKE) mostlyclean
# create logsheet.CALLSIGN.var.tex from logsheet.tex
logsheet.%.tex: logsheet.tex
cp -v $< $@
# clear latex intermediate files for all generated files
srctexfiles += $(PDF_FILES:.pdf=.tex)

194
logsheet.tex Normal file
View file

@ -0,0 +1,194 @@
% SPDX-License-Identifier: Beerware
% Wolfgang DM5WK Kroener wrote this file. As long as you retain this notice you
% 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.
\documentclass[12pt]{article}
%
% configure settings here
%
% configure paperformat here
\def\paper{a4paper}
\newlength{\rowheight}
% configure height of lines
\setlength{\rowheight}{9mm}
% configure number of tables on each page
\def\numtables{2}
% margins of paper defined above
\usepackage[\paper, hmargin=0.7cm, vmargin=0.9cm]{geometry}
% define callsign here or with filename
% e. g. \def\callsign{AB1CD}
% if you define it here, callsign will not be taken from filename
\def\callsign{}
% is this for trainee logging?
% set \trainee to trainee for trainee callsign
% or to traineestroke to get \callsign/T
% if you define it here, trainee will not be taken from filename
\def\trainee{}
%
% normally no configuration below this line
%
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tabularray}
\UseTblrLibrary{functional}
\usepackage{functional}
\NewColumnType{Y}{Q[c,m]}
\NewColumnType{Z}{X[c,m]}
\usepackage{pgffor}
\usepackage{xstring}
\usepackage{fp}
% strip dimension of length and convert to mm
\ExplSyntaxOn
\newcommand\stripdim[1]{\dim_to_decimal_in_unit:nn{#1}{1mm}}
\ExplSyntaxOff
%split \jobname, extract after first dot callsign, after second dot: trainee
% e. g. for logsheet.AB0CD.trainee.tex extract \callsign as AB0CD and \trainee as trainee
% e. g. for logsheet.AB0CD.tex extract \callsign as AB0CD and \trainee is empty
% put \callsign in watermark and add +OP in heading if \trainee equals trainee
\StrCut{\jobname}{.}\strA\strB
\StrLen{\callsign}[\lenTemp]
\IfEq{\lenTemp}{0}{
\StrCut{\strB}{.}\callsign\strC
}{
\StrCut{\strB}{.}\strTemp\strC
}
\StrLen{\trainee}[\lenTemp]
\IfEq{\lenTemp}{0}{
\StrCut{\strC}{.}\trainee\strD
}{}
%add /t to callsign if filename is logbool.CALLSIGN.traineestroke.tex
\IfStrEq{\trainee}{\detokenize{traineestroke}}{
\def\trainee{trainee}
\edef\callsign{\callsign/T}
}
% default scale if there is no callsign (\wmfontscale\paperwidth)
\FPset\wmfontscale{0.25}
\StrLen{\callsign}[\callsignlen]
% calculations for callsign as watermark if there is one
\IfEq{\callsignlen}{0}{}{
% calculate factor for fontsize for diagonal watermark
% (sqrt(w^2+h^2))/(w * factor * callsignlen)
% factor is for callsign going more or less over the whole diagonal
\FPset\w{\stripdim{\paperwidth}}
\FPset\h{\stripdim{\paperheight}}
\FPeval\wmfontscale{root(2,pow(2,h)+pow(2,w))/(w * 0.65 * callsignlen)}
% calculate angle for diagonal text
\FPeval\diagonalAngle{arctan(h/w) * 180/FPpi}
}
% pagenumber as watermark
\FPeval\wmfontscalepagenumber{0.75*wmfontscale}
\usepackage[svgnames]{xcolor}
\usepackage{eso-pic}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{every picture/.style={gray, opacity=0.1}}
\newcommand\wmpagenumber{%
\AddToShipoutPictureBG*{%
\begin{tikzpicture}[overlay]
% first pagenumber
\node at ($(current page.north west)!.5!(current page.center)$)
[font=\fontsize{\wmfontscalepagenumber\paperwidth}{\wmfontscalepagenumber\paperwidth}]
{\bfseries\the\numexpr\thepage};
% then callsign if there is one
\IfEq{\callsignlen}{0}{}{
\node at (current page.center)
[rotate=\diagonalAngle, font=\fontsize{\wmfontscale\paperwidth}{\wmfontscale\paperwidth}]
{\bfseries\callsign};
}
%\draw[red,step=1mm] (0,0) grid (40,40);
\end{tikzpicture}
}
}
% Duplicate page: e. g. two a5 on one a4
\usepackage{pgfmorepages}
\pgfpagesuselayout{2 on 1}[\paper,landscape]
\pagestyle{empty}
\setlength\parindent{0pt}
% calculate, how many lines fit on the paper
\FPset\htext{\stripdim{\textheight}}
\FPset\hlines{\stripdim{\rowheight}}
\FPset\hru{\stripdim{\arrayrulewidth}}
\FPeval\tablelines{trunc((htext/(hlines+hru)), 0)}
\FPeval\tablelinesPlusTwo{round(tablelines + 2, 0)}
\FPeval\tablelinesPlusFour{round(tablelines + 4, 0)}
% add +OP on trainee sheet
\IfStrEq{\trainee}{\detokenize{trainee}}{
\def\locationOp{Location+OP}
}{
\def\locationOp{Location}
}
% add content of table, create #2 times #1/#2 rows, #1/#2 including two header rows
\prgNewFunction \makerows{mm} {
\tlClear \lTmpaTl
\intZero \lTmpaInt
\intStepInline {1} {1} {#1} {
\boolSet \lTmpaBool {\intCompare {\intMathMod{##1-1}{#1 / #2}} = {0} && \intCompare{#1-##1} > {2}}
\boolVarIfTF \lTmpaBool {
\intZero \lTmpaInt
% heading
\tlPutRight \lTmpaTl {\SetVline[=]{##1}{0pt} \SetCell[r=1,c=5]{valign=m,c} \begin{tblr}{colsep=0pt,width=\textwidth,rows={\rowheight},colspec={X[l,m]Q[r,m]}}Date: \hspace*{4cm} \locationOp: & Mode: \hspace*{2cm} \end{tblr}&&&&& \SetVline[=]{##1}{0pt}\\}
}{
\intCompareTF {\intMathMod{##1-2}{\intEval{#1 / #2}}} = {0} {
% column descriptions
\tlPutRight \lTmpaTl {Time & Callsign & RST tx & RST rx & Frequency/Name/Location/Notes\\}
}{
\intIncr \lTmpaInt
% add empty rows with counter
\tlPutRight \lTmpaTl {\hphantom{12345678} & \hphantom{AAA0AAA/AAA0AAA} & & & \SetCell[r=1,c=1]{r} \color{LightGray}}
\tlPutRight \lTmpaTl {\intUse \lTmpaInt}
\tlPutRight \lTmpaTl {\\}
}
}
}
\prgReturn {\expValue{\lTmpaTl}}
}
\begin{document}
\ttfamily
\SetTblrInner{rowsep=0pt,rulesep=0pt}
% two sides (front/back)
\foreach \i in {1,2}
{
% two pages (left/right)
\foreach \j in {1,2}
{
% watermark on every side
\wmpagenumber
\begin{center}
% fix centering
\addtolength{\leftskip} {-2cm}
\addtolength{\rightskip}{-2cm}
\begin{tblr}[evaluate=\makerows]{
rows={\rowheight},
width=\textwidth,
vline{1-Y}={},
hline{2-Z}={},
colspec={YYYYZ Q[colsep=0pt]}
}
\makerows{\tablelines}{\numtables}
\end{tblr}
\end{center}
\newpage
}
}
\end{document}

BIN
sample/logsheet.DL1XXXX.pdf Normal file

Binary file not shown.