country with city if short
This commit is contained in:
@@ -94,6 +94,7 @@ Layout options are set as options to the `\documentclass`, e.g.:
|
|||||||
- `fill` or `nofill`: fill empty space between icon and text, default: `fill`
|
- `fill` or `nofill`: fill empty space between icon and text, default: `fill`
|
||||||
- `qrfirst` or `textfirst`: switch position of QR-Code and text block, default: `qrfirst`
|
- `qrfirst` or `textfirst`: switch position of QR-Code and text block, default: `qrfirst`
|
||||||
- `https` or `www`: should links in the hints be prefixed with `https://` or `www.`, default: `https`
|
- `https` or `www`: should links in the hints be prefixed with `https://` or `www.`, default: `https`
|
||||||
|
- `countryformat=`: how to format the country in address. Values: `auto` (default: inline with mdash if <4 chars and city/zip exists), `inline` (always inline with mdash), `below` (always separate line)
|
||||||
- `qreclevel=`: QR error correction level `L` (~7%), `M` (~15%), `Q` (~25%), or `H` (~30%), default: `Q`. Use `H` when `photoinqr=true`.
|
- `qreclevel=`: QR error correction level `L` (~7%), `M` (~15%), `Q` (~25%), or `H` (~30%), default: `Q`. Use `H` when `photoinqr=true`.
|
||||||
- `photoinqr` or `nophotoinqr`: place photo in the center of the QR code (`photoinqr`) instead of next to the name, default: `nophotoinqr`. **Requires `qreclevel=H` for reliable scanning**.
|
- `photoinqr` or `nophotoinqr`: place photo in the center of the QR code (`photoinqr`) instead of next to the name, default: `nophotoinqr`. **Requires `qreclevel=H` for reliable scanning**.
|
||||||
- `qrlogoscale=`: photo size in QR code as percentage of QR width (0-100), default: `25` (25% width = 6.25% area). Recommended values: Level H: 25-30%, Level Q: 20%, Level M: 15%, Level L: 10%. Higher values may reduce scannability.
|
- `qrlogoscale=`: photo size in QR code as percentage of QR width (0-100), default: `25` (25% width = 6.25% area). Recommended values: Level H: 25-30%, Level Q: 20%, Level M: 15%, Level L: 10%. Higher values may reduce scannability.
|
||||||
@@ -133,7 +134,7 @@ See this example_
|
|||||||
- `\city`: name of the address location
|
- `\city`: name of the address location
|
||||||
- `\region`: region of the address
|
- `\region`: region of the address
|
||||||
- `\zip`: zip code of the address
|
- `\zip`: zip code of the address
|
||||||
- `\country`: full name of country of the address in the language of the card
|
- `\country`: full name of country of the address in the language of the card (short codes like `CH`, `USA`, `D` are automatically placed inline with mdash before city/zip, longer names on separate line)
|
||||||
- `\phone`: your phone number, the phone is marked as mobile, so to be used for voice and text (SMS)
|
- `\phone`: your phone number, the phone is marked as mobile, so to be used for voice and text (SMS)
|
||||||
- `\email`: your email address
|
- `\email`: your email address
|
||||||
- `\jabber`: your [jabber] or xmpp chat address
|
- `\jabber`: your [jabber] or xmpp chat address
|
||||||
|
|||||||
+36
-3
@@ -42,6 +42,7 @@
|
|||||||
\DeclareComplementaryOption{textfirst}{qrfirst}
|
\DeclareComplementaryOption{textfirst}{qrfirst}
|
||||||
\DeclareBoolOption[true]{https}
|
\DeclareBoolOption[true]{https}
|
||||||
\DeclareComplementaryOption{www}{https}
|
\DeclareComplementaryOption{www}{https}
|
||||||
|
\DeclareStringOption[auto]{countryformat} % auto: <4 chars inline with mdash, >=4 separate line; inline: always inline; below: always separate line
|
||||||
\DeclareDefaultOption{\@unknownoptionerror}
|
\DeclareDefaultOption{\@unknownoptionerror}
|
||||||
\ProcessKeyvalOptions*
|
\ProcessKeyvalOptions*
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@
|
|||||||
\RequirePackage{fontawesome}
|
\RequirePackage{fontawesome}
|
||||||
\RequirePackage[final]{qrcode}
|
\RequirePackage[final]{qrcode}
|
||||||
\RequirePackage{etoolbox}
|
\RequirePackage{etoolbox}
|
||||||
|
\RequirePackage{xstring} % for string length checking
|
||||||
\RequirePackage{DejaVuSans}
|
\RequirePackage{DejaVuSans}
|
||||||
\RequirePackage[T1]{fontenc}
|
\RequirePackage[T1]{fontenc}
|
||||||
\RequirePackage{wrapfig}
|
\RequirePackage{wrapfig}
|
||||||
@@ -145,7 +147,6 @@
|
|||||||
\newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}}
|
\newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}}
|
||||||
\newcommand\heightscale{\dimexpr\textheight-\ifcsempty{name}{0em}{2em}-\ifcsdef{Xpgpfingerprint}{2em}{0em}-\ifcsdef{Xadditionalnames}{2em}{0em}\relax}
|
\newcommand\heightscale{\dimexpr\textheight-\ifcsempty{name}{0em}{2em}-\ifcsdef{Xpgpfingerprint}{2em}{0em}-\ifcsdef{Xadditionalnames}{2em}{0em}\relax}
|
||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
|
% 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\name{\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }\ifexists{Xgivennames}{\Xgivennames\ }\ifexists{Xfamilynames}{\Xfamilynames}\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}}
|
||||||
@@ -192,6 +193,38 @@ FN:\name\ifexists{Xadditionalnames}{\ifcsempty{name}{} { }\Xadditionalnames}\BCQ
|
|||||||
END:VCARD\BCQ@nl}
|
END:VCARD\BCQ@nl}
|
||||||
|
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% formatcountry - format country based on length and options
|
||||||
|
\newcommand\formatcountry{%
|
||||||
|
\ifcsdef{Xcountry}{%
|
||||||
|
\def\BCQ@shouldinline{false}%
|
||||||
|
% Check countryformat option
|
||||||
|
\ifdefstring{\BCQ@countryformat}{inline}{%
|
||||||
|
\def\BCQ@shouldinline{true}%
|
||||||
|
}{%
|
||||||
|
\ifdefstring{\BCQ@countryformat}{below}{%
|
||||||
|
\def\BCQ@shouldinline{false}%
|
||||||
|
}{%
|
||||||
|
% auto mode: check length
|
||||||
|
\StrLen{\Xcountry}[\BCQ@countrylen]%
|
||||||
|
\ifnum\BCQ@countrylen<4\relax%
|
||||||
|
% Short country code AND city/zip exists → inline
|
||||||
|
\ifboolexpr{test {\ifcsdef{Xcity}} or test {\ifcsdef{Xzip}}}{%
|
||||||
|
\def\BCQ@shouldinline{true}%
|
||||||
|
}{}%
|
||||||
|
\fi%
|
||||||
|
}%
|
||||||
|
}%
|
||||||
|
% Output country
|
||||||
|
\ifdefstring{\BCQ@shouldinline}{true}{%
|
||||||
|
\Xcountry\ \textemdash\ %
|
||||||
|
}{%
|
||||||
|
\Xcountry
|
||||||
|
|
||||||
|
}%
|
||||||
|
}{}%
|
||||||
|
}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% address - the address as shown in the textbox
|
% address - the address as shown in the textbox
|
||||||
\newcommand\address{
|
\newcommand\address{
|
||||||
@@ -202,9 +235,9 @@ END:VCARD\BCQ@nl}
|
|||||||
|
|
||||||
\cond{Xstreet}
|
\cond{Xstreet}
|
||||||
|
|
||||||
\cond{Xzip} \cond{Xcity}
|
\formatcountry\cond{Xzip} \cond{Xcity}
|
||||||
|
|
||||||
\cond{Xregion} \cond{Xcountry}
|
\cond{Xregion}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
|||||||
|
% !TeX program = xelatex
|
||||||
|
\documentclass{businesscard-qrcode}
|
||||||
|
|
||||||
|
\type{home}
|
||||||
|
\givennames{Max}
|
||||||
|
\familynames{Muster}
|
||||||
|
\street{Beispielstrasse\ 42}
|
||||||
|
\city{Winterthur}
|
||||||
|
\zip{8400}
|
||||||
|
\country{CH}
|
||||||
|
\phone{+41 52 123 45 67}
|
||||||
|
\email{max@example.ch}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\drawcard
|
||||||
|
\end{document}
|
||||||
Reference in New Issue
Block a user