Add Title Role

This commit is contained in:
Marc Wäckerlin
2025-11-10 13:07:52 +01:00
parent 793c7f9360
commit dd92e3c5df
22 changed files with 72 additions and 26 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"makefile.configureOnOpen": false
}
+63 -22
View File
@@ -104,7 +104,9 @@
\registerData{honoricprefix} \registerData{honoricprefix}
\registerData{honoricsuffix} \registerData{honoricsuffix}
\registerData{company} \registerData{company}
\registerData{additionalnames}
\registerData{pobox} \registerData{pobox}
\registerData{role}
\registerData{extaddr} \registerData{extaddr}
\registerData{street} \registerData{street}
\registerData{city} \registerData{city}
@@ -133,6 +135,14 @@
\registerData{pgpurl} \registerData{pgpurl}
\registerData{pgpfingerprint} \registerData{pgpfingerprint}
% Override document \title to capture card title (original available via \carddocumenttitle)
\let\BCQ@documenttitle\title
\renewcommand\title[1]{%
\def\Xtitle{#1}%
}
\newcommand\carddocumenttitle[1]{%
\BCQ@documenttitle{#1}%
}
% Special commands with optional parameters % Special commands with optional parameters
% \logo[height=...]{file} - logo next to name, overrides logoheight option % \logo[height=...]{file} - logo next to name, overrides logoheight option
\define@key{BCQ@logo}{height}{\def\BCQ@logoheight@local{#1}} \define@key{BCQ@logo}{height}{\def\BCQ@logoheight@local{#1}}
@@ -193,11 +203,21 @@
\newlength{\BCQ@reservedheight} \newlength{\BCQ@reservedheight}
\newlength{\BCQ@heightscale} \newlength{\BCQ@heightscale}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
\newcommand\personalname{%
\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }%
\ifexists{Xgivennames}{\Xgivennames\ }%
\ifexists{Xadditionalnames}{\Xadditionalnames\ }%
\ifexists{Xfamilynames}{\Xfamilynames}%
\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}%
}
% heightscale - calculate available height for text/QR % heightscale - calculate available height for text/QR
% Uses actual logo height if logo is taller than default reserved space % Uses actual logo height if logo is taller than default reserved space
% This is computed as a length and stored, not a macro % This is computed as a length and stored, not a macro
\newcommand\computeheightscale{% \newcommand\computeheightscale{%
\setlength{\BCQ@reservedheight}{\dimexpr\ifcsempty{name}{0em}{2em}+\ifcsdef{Xcompany}{2em}{0em}\relax}% \setlength{\BCQ@reservedheight}{\dimexpr\ifcsempty{personalname}{0em}{2em}+\ifcsdef{Xcompany}{2em}{0em}\relax}%
\ifdim\BCQ@logoheightdimen>\BCQ@reservedheight \ifdim\BCQ@logoheightdimen>\BCQ@reservedheight
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}% \setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
\else \else
@@ -206,9 +226,31 @@
} }
\newcommand\heightscale{\BCQ@heightscale} \newcommand\heightscale{\BCQ@heightscale}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand\companyrolestring{%
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames \ifcsdef{Xcompany}{%
\newcommand\name{\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }\ifexists{Xgivennames}{\Xgivennames\ }\ifexists{Xfamilynames}{\Xfamilynames}\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}} \ifcsdef{Xtitle}{%
\Xtitle%
\ifcsdef{Xrole}{, \Xrole}{}%
\ \Xcompany%
}{%
\ifcsdef{Xrole}{%
\Xrole\ \Xcompany%
}{%
\Xcompany%
}%
}%
}{}%
}
\newcommand\name{%
\personalname
\ifcsdef{Xcompany}{%
\ifcsempty{personalname}{%
\companyrolestring
}{%
\ (\companyrolestring)%
}%
}{}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -222,8 +264,11 @@
% vcard assembly (version 4.0 retained). CRLF improves iOS import robustness. % vcard assembly (version 4.0 retained). CRLF improves iOS import robustness.
\newcommand\vcard{BEGIN:VCARD\BCQ@nl \newcommand\vcard{BEGIN:VCARD\BCQ@nl
VERSION:4.0\BCQ@nl VERSION:4.0\BCQ@nl
N:\cond{Xfamilynames};\cond{Xgivennames};\cond{Xcompany};\cond{Xhonoricprefix};\cond{Xhonoricsuffix}\BCQ@nl N:\cond{Xfamilynames};\cond{Xgivennames};\cond{Xadditionalnames};\cond{Xhonoricprefix};\cond{Xhonoricsuffix}\BCQ@nl
FN:\name\ifexists{Xcompany}{\ifcsempty{name}{} { }\Xcompany}\BCQ@nl FN:\name\BCQ@nl
\ifexists{Xcompany}{ORG:\Xcompany\BCQ@nl}
\ifexists{Xtitle}{TITLE:\Xtitle\BCQ@nl}
\ifexists{Xrole}{ROLE:\Xrole\BCQ@nl}
\ifexists{printaddress}{ADR\ifexists{Xtype}{;TYPE=\Xtype}:\cond{Xpobox};\cond{Xextaddr};\cond{Xstreet};\cond{Xcity};\cond{Xregion};\cond{Xzip};\cond{Xcountry}\BCQ@nl} \ifexists{printaddress}{ADR\ifexists{Xtype}{;TYPE=\Xtype}:\cond{Xpobox};\cond{Xextaddr};\cond{Xstreet};\cond{Xcity};\cond{Xregion};\cond{Xzip};\cond{Xcountry}\BCQ@nl}
\ifexists{Xphone}{TEL;VALUE=uri;TYPE=\ifexists{Xtype}{\Xtype,}voice,text:tel:\Xphone\BCQ@nl} \ifexists{Xphone}{TEL;VALUE=uri;TYPE=\ifexists{Xtype}{\Xtype,}voice,text:tel:\Xphone\BCQ@nl}
\ifexists{Xemail}{EMAIL\ifexists{Xtype}{;TYPE=\Xtype}:\Xemail\BCQ@nl} \ifexists{Xemail}{EMAIL\ifexists{Xtype}{;TYPE=\Xtype}:\Xemail\BCQ@nl}
@@ -273,12 +318,16 @@ END:VCARD\BCQ@nl}
}% }%
% Output country % Output country
\ifdefstring{\BCQ@shouldinline}{true}{% \ifdefstring{\BCQ@shouldinline}{true}{%
\Xcountry\ \textemdash\ % \Xcountry\ \textemdash\ \cond{Xzip} \cond{Xcity}%
}{% }{%
\cond{Xzip} \cond{Xcity}
\Xcountry \Xcountry
}% }%
}{}% }{
\cond{Xzip} \cond{Xcity}
}%
} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,7 +340,7 @@ END:VCARD\BCQ@nl}
\cond{Xstreet} \cond{Xstreet}
\formatcountry\cond{Xzip} \cond{Xcity} \formatcountry
\cond{Xregion} \cond{Xregion}
@@ -381,7 +430,7 @@ END:VCARD\BCQ@nl}
% insertname - insert the name on the top % insertname - insert the name on the top
\newcommand\insertname{ \newcommand\insertname{
% typeset name into box for measurement % typeset name into box for measurement
\sbox{\BCQ@namebox}{\bfseries\cond{name}\ifexists{Xcompany}{\ifcsempty{name}{} { }\Xcompany}}% \sbox{\BCQ@namebox}{\bfseries\cond{name}}%
% Set default logoheight if not specified: 4em with company, 2em without % Set default logoheight if not specified: 4em with company, 2em without
\ifx\BCQ@logoheight\@empty \ifx\BCQ@logoheight\@empty
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}% \ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
@@ -410,22 +459,14 @@ END:VCARD\BCQ@nl}
\begin{minipage}[c]{0.67\textwidth}% name column \begin{minipage}[c]{0.67\textwidth}% name column
\ifBCQ@rightalign\raggedleft\fi% apply alignment \ifBCQ@rightalign\raggedleft\fi% apply alignment
{\bfseries\cond{name}}% {\bfseries\cond{name}}%
% Show companylogo if set (only logo), otherwise show company text % Optional company logo below name
\ifcsdef{Xcompanylogo}{% \ifcsdef{Xcompanylogo}{\\\Xcompanylogo}{}%
\\\Xcompanylogo% only show logo
}{%
\ifexists{Xcompany}{\\\Xcompany}% show company text
}%
\end{minipage} \end{minipage}
\end{minipage} \end{minipage}
}{% no logo: just name }{% no logo: just name
{\bfseries\cond{name}}% {\bfseries\cond{name}}%
% Show companylogo if set (only logo), otherwise show company text % Optional company logo below name
\ifcsdef{Xcompanylogo}{% \ifcsdef{Xcompanylogo}{\\\Xcompanylogo}{}%
\\\Xcompanylogo% only show logo
}{%
\ifexists{Xcompany}{\\\Xcompany}% show company text
}%
} }
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -16,5 +16,5 @@ dist_examples_DATA = $(EXAMPLES:%=%.tex) $(EXAMPLES:%=%.pdf)
%.pdf:%.tex %.pdf:%.tex
xelatex -synctex=1 -interaction=nonstopmode $< xelatex -synctex=1 -interaction=nonstopmode $<
CLEANFILES = $(EXAMPLES:%=%.aux) $(EXAMPLES:%=%.log) $(EXAMPLES:%=%.synctex.gz) $(EXAMPLES:%=%.fdb_latexmk) $(EXAMPLES:%=%.fls) $(EXAMPLES:%=%.xdv) CLEANFILES = $(EXAMPLES:%=%.aux) $(EXAMPLES:%=%.pdf) $(EXAMPLES:%=%.log) $(EXAMPLES:%=%.synctex.gz) $(EXAMPLES:%=%.fdb_latexmk) $(EXAMPLES:%=%.fls) $(EXAMPLES:%=%.xdv)
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -3
View File
@@ -1,9 +1,9 @@
% !TeX program = xelatex % !TeX program = xelatex
\documentclass[logoinqr,qrlogoscale=0.4,qreclevel=H]{businesscard-qrcode} \documentclass[qrbgopacity=0.5]{businesscard-qrcode}
\type{home} \type{home}
\givennames{Lisa\ Linda} \givennames{Lisa\ Linda}
\familynames{Doe} \familynames{Döë}
\company{Example\ Company} \company{Example\ Company}
\street{Main\ Street\ 123} \street{Main\ Street\ 123}
\city{New\ York} \city{New\ York}
@@ -12,7 +12,9 @@
\phone{+1 234 567 8900} \phone{+1 234 567 8900}
\email{ldoe@example.com} \email{ldoe@example.com}
\homepage{example.com} \homepage{example.com}
%\logo{photo.png} % uncomment if photo.png exists \logo{photo.png}
\qrlogo[scale=.6]{logo.png}
\background[opacity=0.5,scale=1.2]{background.png}
\begin{document} \begin{document}
\drawcard \drawcard
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB