From 24f42ab403749e5dad59fda007da9eea495cbcc4 Mon Sep 17 00:00:00 2001 From: nobody Date: Thu, 19 Dec 2024 05:29:39 +0100 Subject: [PATCH] fix multiline fields --- cccbform.cls | 38 +++++++++++++++++++------------------- doku.tex | 14 -------------- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/cccbform.cls b/cccbform.cls index 407d516..3d876c1 100644 --- a/cccbform.cls +++ b/cccbform.cls @@ -259,7 +259,7 @@ % TextField*{label} - a single-line input (starred version uses all available space) \RenewDocumentCommand{\TextField}{s m}{% - \par% + \par\addvspace{1.5\formskip}% \ifMultiColumn% \pgfmathsetmacro{\@tlen}{1.0}% \else% @@ -269,19 +269,19 @@ \fi% \begin{tikzpicture}[baseline] \useasboundingbox (0,0) rectangle (\@tlen\textwidth,\formfieldheight); - \node[anchor=west] at (0, 0) { + \node[anchor=base west] at (0, 0) { \full@TextField[\@tlen] }; - \node[anchor=west,rotate=\labelangle] at (-1em,0.4\formfieldheight) { + \node[anchor=base west,rotate=\labelangle] at (-1em,0.6\formfieldheight) { \ttfamily\footnotesize #2\strut }; \end{tikzpicture}% - \par\addvspace{1.5\formskip}% + \par\addvspace{\formskip}% } % ShortTextField[width]{label} - a single-line input with reduced width \NewDocumentCommand{\ShortTextField}{o m}{% - \par% + \par\addvspace{1.5\formskip}% \IfValueTF{#1}{\pgfmathsetmacro{\@tlen}{#1}}{% \ifMultiColumn% \pgfmathsetmacro{\@tlen}{\normalfieldwidth}% @@ -291,10 +291,10 @@ }% \begin{tikzpicture}[baseline] \useasboundingbox (0,0) rectangle (\@tlen\textwidth,\formfieldheight); - \node[anchor=west] at (0,0) { + \node[anchor=base west] at (0,0) { \full@TextField[\@tlen] }; - \node[anchor=west,rotate=\labelangle] at (-1em,0.4\formfieldheight) { + \node[anchor=base west,rotate=\labelangle] at (-1em,0.6\formfieldheight) { \ttfamily\footnotesize #2\strut }; \end{tikzpicture}% @@ -302,8 +302,8 @@ } % MultilineTextField*[height]{label} - a multi-line input, starred version uses all available width -\NewDocumentCommand{\MultilineTextField}{s O{} m}{% - \par\addvspace{\formskip}% +\NewDocumentCommand{\MultilineTextField}{s O{\formfieldheight} m}{% + \par\addvspace{1.5\formskip}% \ifMultiColumn% \pgfmathsetmacro{\@tlen}{1.0}% \else% @@ -312,11 +312,11 @@ {\pgfmathsetmacro{\@tlen}{\normalfieldwidth}}% \fi% \begin{tikzpicture}[baseline] - \useasboundingbox (0,0) rectangle (\@tlen\textwidth,\formfieldheight); - \node[anchor=west] at (0,0) { + \useasboundingbox (0,0) rectangle (\@tlen\textwidth, #2); + \node[anchor=base west] at (0,0) { \full@MultilineTextField<#2>[\@tlen] }; - \node[anchor=west,rotate=\labelangle] at (-1em,0.4\formfieldheight) { + \node[anchor=base west,rotate=\labelangle] at (-1em,#2 - 0.4\formfieldheight) { \ttfamily\footnotesize #3\strut }; \end{tikzpicture} @@ -325,7 +325,7 @@ % Signature[label] - a field not fillable on the computer, big enough for a signature \NewDocumentCommand{\Signature}{O{Datum, Unterschrift}}{% - \par\addvspace{\formskip}% + \par\addvspace{2\formskip}% \ifMultiColumn% \pgfmathsetmacro{\@tlen}{\normalfieldwidth}% \else% @@ -333,26 +333,26 @@ \fi% \begin{tikzpicture}[baseline] \useasboundingbox (0,0) rectangle (\@tlen\textwidth,1.0cm); - \node[anchor=west] at (0,0) { + \node[anchor=base west] at (0,0) { \fake@MultilineTextField<1.0cm>[\@tlen] }; - \node[anchor=north west,rotate=\labelangle] at (-1em,1cm -0.4\formfieldheight) { + \node[anchor=base west,rotate=\labelangle] at (-1em,1cm - 0.4\formfieldheight) { \ttfamily\footnotesize #1\strut }; \end{tikzpicture} - \par\addvspace{2\formskip}% + \par\addvspace{\formskip}% } % Notes[label] - a slightly taller fake field that fills the whole width \NewDocumentCommand{\Notes}{O{Vermerke}}{% - \par\addvspace{\formskip}% + \par\addvspace{1.5\formskip}% \pgfmathsetmacro{\@tlen}{1.0} \begin{tikzpicture}[baseline] \useasboundingbox (0,0) rectangle (\@tlen\textwidth,1.5cm); - \node[anchor=west] at (0,0) { + \node[anchor=base west] at (0,0) { \fake@MultilineTextField<1.5cm>[\@tlen] }; - \node[anchor=north west,rotate=\labelangle] at (-1em,1.5cm -0.9\formfieldheight) { + \node[anchor=base west,rotate=\labelangle] at (-1em,1.5cm - 0.4\formfieldheight) { \ttfamily\footnotesize #1\strut }; \end{tikzpicture} diff --git a/doku.tex b/doku.tex index b8af3a9..1e97340 100644 --- a/doku.tex +++ b/doku.tex @@ -297,7 +297,6 @@ end \begin{itemize} \item Inline-Textfeld \item Grundsätze des aktuellen Designs -\item Bug: Höhe Multiline-Textfeld in example \item \TeX-Intro zum Ende, +build info \end{itemize} @@ -549,26 +548,17 @@ sollte sie immer angegeben werden -- ansonsten hat das Feld die Standard-Höhe von normalen Textfeldern. \begin{ShortExample}{multilinetextfield}{mehrzeiliges Textfeld} -%%% FIXME bug in preview (works in doc) -\Text{} \MultilineTextField[2cm]{Kringel} -\Text{} \end{ShortExample} \begin{ShortExample}{multilinetextfieldbad}{einzeiliges mehrzeiliges Textfeld} -%%% FIXME bug in preview (works in doc) -\Text{} \MultilineTextField{Kringel} -\Text{} \end{ShortExample} Auch hier gibt es wieder die Variante mit Stern für volle Breite: \begin{ShortExample}{multilinetextfieldstar}{breites mehrzeiliges Textfeld} -%%% FIXME bug in preview (works in doc) -\Text{} \MultilineTextField*[2cm]{Kringel} -\Text{} \end{ShortExample} \paragraph{Spezialfälle} Unterschriften sollen üblicherweise händisch gesetzt @@ -593,17 +583,13 @@ Das Label kann optional geändert werden. Ebenfalls gibt es ein etwas größeres Feld für Notizen oder Vermerke. \begin{ShortExample}{notes}{großes Feld} -%%% FIXME bug in preview (works in doc) \Notes -\Text{} \end{ShortExample} Auch hier kann optional das Label geändert werden. \begin{ShortExample}{notesopt}{großes Feld} -%%% FIXME bug in preview (works in doc) \Notes[Stirnabdruck] -\Text{} \end{ShortExample} \subsection{Checkboxen}