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{honoricsuffix}
\registerData{company}
\registerData{additionalnames}
\registerData{pobox}
\registerData{role}
\registerData{extaddr}
\registerData{street}
\registerData{city}
@@ -133,6 +135,14 @@
\registerData{pgpurl}
\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
% \logo[height=...]{file} - logo next to name, overrides logoheight option
\define@key{BCQ@logo}{height}{\def\BCQ@logoheight@local{#1}}
@@ -193,11 +203,21 @@
\newlength{\BCQ@reservedheight}
\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
% Uses actual logo height if logo is taller than default reserved space
% This is computed as a length and stored, not a macro
\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
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
\else
@@ -206,9 +226,31 @@
}
\newcommand\heightscale{\BCQ@heightscale}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
\newcommand\name{\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }\ifexists{Xgivennames}{\Xgivennames\ }\ifexists{Xfamilynames}{\Xfamilynames}\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}}
\newcommand\companyrolestring{%
\ifcsdef{Xcompany}{%
\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.
\newcommand\vcard{BEGIN:VCARD\BCQ@nl
VERSION:4.0\BCQ@nl
N:\cond{Xfamilynames};\cond{Xgivennames};\cond{Xcompany};\cond{Xhonoricprefix};\cond{Xhonoricsuffix}\BCQ@nl
FN:\name\ifexists{Xcompany}{\ifcsempty{name}{} { }\Xcompany}\BCQ@nl
N:\cond{Xfamilynames};\cond{Xgivennames};\cond{Xadditionalnames};\cond{Xhonoricprefix};\cond{Xhonoricsuffix}\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{Xphone}{TEL;VALUE=uri;TYPE=\ifexists{Xtype}{\Xtype,}voice,text:tel:\Xphone\BCQ@nl}
\ifexists{Xemail}{EMAIL\ifexists{Xtype}{;TYPE=\Xtype}:\Xemail\BCQ@nl}
@@ -273,12 +318,16 @@ END:VCARD\BCQ@nl}
}%
% Output country
\ifdefstring{\BCQ@shouldinline}{true}{%
\Xcountry\ \textemdash\ %
\Xcountry\ \textemdash\ \cond{Xzip} \cond{Xcity}%
}{%
\cond{Xzip} \cond{Xcity}
\Xcountry
}%
}{}%
}{
\cond{Xzip} \cond{Xcity}
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,7 +340,7 @@ END:VCARD\BCQ@nl}
\cond{Xstreet}
\formatcountry\cond{Xzip} \cond{Xcity}
\formatcountry
\cond{Xregion}
@@ -381,7 +430,7 @@ END:VCARD\BCQ@nl}
% insertname - insert the name on the top
\newcommand\insertname{
% 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
\ifx\BCQ@logoheight\@empty
\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
\ifBCQ@rightalign\raggedleft\fi% apply alignment
{\bfseries\cond{name}}%
% Show companylogo if set (only logo), otherwise show company text
\ifcsdef{Xcompanylogo}{%
\\\Xcompanylogo% only show logo
}{%
\ifexists{Xcompany}{\\\Xcompany}% show company text
}%
% Optional company logo below name
\ifcsdef{Xcompanylogo}{\\\Xcompanylogo}{}%
\end{minipage}
\end{minipage}
}{% no logo: just name
{\bfseries\cond{name}}%
% Show companylogo if set (only logo), otherwise show company text
\ifcsdef{Xcompanylogo}{%
\\\Xcompanylogo% only show logo
}{%
\ifexists{Xcompany}{\\\Xcompany}% show company text
}%
% Optional company logo below name
\ifcsdef{Xcompanylogo}{\\\Xcompanylogo}{}%
}
}
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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -3
View File
@@ -1,9 +1,9 @@
% !TeX program = xelatex
\documentclass[logoinqr,qrlogoscale=0.4,qreclevel=H]{businesscard-qrcode}
\documentclass[qrbgopacity=0.5]{businesscard-qrcode}
\type{home}
\givennames{Lisa\ Linda}
\familynames{Doe}
\familynames{Döë}
\company{Example\ Company}
\street{Main\ Street\ 123}
\city{New\ York}
@@ -12,7 +12,9 @@
\phone{+1 234 567 8900}
\email{ldoe@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}
\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