options updated, local options added
This commit is contained in:
@@ -95,14 +95,13 @@ Layout options are set as options to the `\documentclass`, e.g.:
|
||||
- `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`
|
||||
- `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 `logoinqr=true`.
|
||||
- `logoinqr` or `nologoinqr`: place logo in the center of the QR code (`logoinqr`) instead of next to the name, default: `nologoinqr`. **Requires `qreclevel=H` for reliable scanning**.
|
||||
- `qrlogoscale=`: logo size in QR code as fraction of QR width (1.0 = 100%), default: `0.25` (25% width). Recommended values: Level H: 0.25-0.3, Level Q: 0.2, Level M: 0.15, Level L: 0.1. Higher values may reduce scannability.
|
||||
- `qreclevel=`: QR error correction level `L` (~7%), `M` (~15%), `Q` (~25%), or `H` (~30%), default: `H`. Use `H` when embedding logo in QR code.
|
||||
- `qrlogoscale=`: logo size in QR code as fraction of QR width (1.0 = 100%), default: `0.25` (25% width). Recommended values: Level H: 0.25-0.3, Level Q: 0.2, Level M: 0.15, Level L: 0.1. Higher values may reduce scannability. Can be overridden locally with `\qrlogo[scale=...]{file}`.
|
||||
- `qrlogoborder=`: transparent padding around logo in QR code as fraction of QR width (1.0 = 100%), default: `0.02` (2%). Adds space between logo and QR modules.
|
||||
- `logoheight=`: logo height next to name with unit (e.g., `4em`, `6em`), default: `4em` if company is set, `2em` otherwise.
|
||||
- `bgscale=`: background image scale factor (1.0 = 100% of card height), default: `1.0`. Use values like `1.5` or `2.0` for zoomed/cropped backgrounds. Only affects images, not colors.
|
||||
- `bgopacity=`: background image opacity/transparency (1.0 = 100% visible, 0.0 = invisible), default: `1.0`. Use lower values like `0.2` or `0.3` to fade the background so text remains readable. Only affects images, not colors.
|
||||
- `qrbgopacity=`: QR code background opacity (1.0 = solid white, 0.0 = transparent), default: `1.0`. White background behind QR code ensures scannability over background images. Use `0.0` for no background or lower values like `0.8` for semi-transparent.
|
||||
- `logoheight=`: logo height next to name with unit (e.g., `4em`, `6em`), default: `4em` if company is set, `2em` otherwise. Can be overridden locally with `\logo[height=...]{file}`.
|
||||
- `bgscale=`: background image scale factor (1.0 = 100% of card height), default: `1.0`. Use values like `1.5` or `2.0` for zoomed/cropped backgrounds. Only affects images, not colors. Can be overridden locally with `\background[scale=...]{file}`.
|
||||
- `bgopacity=`: background image opacity/transparency (1.0 = 100% visible, 0.0 = invisible), default: `1.0`. Use lower values like `0.2` or `0.3` to fade the background so text remains readable. Only affects images, not colors. Can be overridden locally with `\background[opacity=...]{file}`.
|
||||
- `qrbgopacity=`: QR code background opacity (1.0 = solid white, 0.0 = transparent), default: `1.0`. White background behind QR code ensures scannability over background images. Use `0.0` for no background or lower values like `0.8` for semi-transparent. Can be overridden locally with `\qrlogo[opacity=...]{file}`.
|
||||
|
||||
|
||||
Data Definitions
|
||||
@@ -160,8 +159,10 @@ See this example_
|
||||
- `\google`: your account name on [google+] — only the name of the account, the url is prepended automatically
|
||||
- `\pgpurl`: the full url to your pgp public key (only added to the QR-Code, not shown in the text)
|
||||
- `\pgpfingerprint`: the fingerprint of your pgp public key
|
||||
- `\logo`: path to logo file (PNG, JPG, etc.) for display next to name or in QR code (if `logoinqr` option is set)
|
||||
- `\background`: path to background image file or color name (e.g., `yellow!20`, `blue!10`). If file exists, it's used as image; otherwise treated as color.
|
||||
- `\logo[height=...]{file}`: path to logo file (PNG, JPG, etc.) for display next to name. Optional `height` parameter (e.g., `height=6em`) overrides global `logoheight` option.
|
||||
- `\qrlogo[scale=...,opacity=...]{file}`: path to logo file for display in QR code center. Optional parameters: `scale` (fraction like `0.3` for 30% of QR width) overrides `qrlogoscale`, `opacity` (0.0-1.0) overrides `qrbgopacity`.
|
||||
- `\companylogo{content}`: arbitrary content (e.g., `\includegraphics[width=3cm]{logo.png}`) displayed instead of company text below name. Company text still appears in vCard.
|
||||
- `\background[scale=...,opacity=...]{file/color}`: path to background image file or color name (e.g., `yellow!20`, `blue!10`). If file exists, it's used as image; otherwise treated as color. Optional parameters: `scale` (factor like `1.5`) overrides `bgscale`, `opacity` (0.0-1.0) overrides `bgopacity`.
|
||||
|
||||
|
||||
Print the Card
|
||||
|
||||
+95
-36
@@ -20,7 +20,7 @@
|
||||
\DeclareStringOption[1]{cutlen}
|
||||
\DeclareStringOption[0.50]{textwidth}
|
||||
\DeclareStringOption[0.40]{qrwidth}
|
||||
\DeclareStringOption[Q]{qreclevel} % QR code error correction level (L,M,Q,H) default Q
|
||||
\DeclareStringOption[H]{qreclevel} % QR code error correction level (L,M,Q,H)
|
||||
\DeclareStringOption[0.25]{qrlogoscale} % logo size in QR code as fraction of QR width (1.0 = 100%), default 0.25
|
||||
\DeclareStringOption[0.02]{qrlogoborder} % white padding around logo in QR as fraction of QR width (1.0 = 100%), default 0.02
|
||||
\DeclareStringOption{logoheight} % logo height next to name (with unit, e.g., 4em), default: 4em if company set, 2em otherwise
|
||||
@@ -29,7 +29,6 @@
|
||||
\DeclareStringOption[1.0]{qrbgopacity} % QR code background opacity (1.0 = white solid, 0.0 = transparent), default 1.0
|
||||
\DeclareStringOption[de]{lang}
|
||||
\DeclareBoolOption[false]{ioscrlf} % use CRLF line endings in vCard (iOS compatibility); default off to avoid pdfTeX issues
|
||||
\DeclareBoolOption[false]{logoinqr} % if true: logo goes in QR center; if false (default): logo next to name
|
||||
\DeclareBoolOption[true]{address}
|
||||
\DeclareComplementaryOption{noaddress}{address}
|
||||
\DeclareBoolOption[true]{hint}
|
||||
@@ -133,8 +132,41 @@
|
||||
\registerData{google}
|
||||
\registerData{pgpurl}
|
||||
\registerData{pgpfingerprint}
|
||||
\registerData{logo} % path to logo file for display next to name
|
||||
\registerData{background} % path to background image file or color name
|
||||
|
||||
% 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}}
|
||||
\newcommand\logo[2][]{
|
||||
\def\Xlogo{#2}
|
||||
\def\BCQ@logo@tmp{#1}%
|
||||
\ifx\BCQ@logo@tmp\@empty\else
|
||||
\setkeys{BCQ@logo}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
% \qrlogo[scale=...,opacity=...]{file} - logo in QR code center (scale is unitless fraction like 0.3)
|
||||
\define@key{BCQ@qrlogo}{scale}{\def\BCQ@qrlogoscale@local{#1}}
|
||||
\define@key{BCQ@qrlogo}{opacity}{\def\BCQ@qrbgopacity@local{#1}}
|
||||
\newcommand\qrlogo[2][]{
|
||||
\def\Xqrlogo{#2}
|
||||
\def\BCQ@qrlogo@tmp{#1}%
|
||||
\ifx\BCQ@qrlogo@tmp\@empty\else
|
||||
\setkeys{BCQ@qrlogo}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
% \background[scale=...,opacity=...]{file/color} - background image or color
|
||||
\define@key{BCQ@background}{scale}{\def\BCQ@bgscale@local{#1}}
|
||||
\define@key{BCQ@background}{opacity}{\def\BCQ@bgopacity@local{#1}}
|
||||
\newcommand\background[2][]{
|
||||
\def\Xbackground{#2}
|
||||
\def\BCQ@background@tmp{#1}%
|
||||
\ifx\BCQ@background@tmp\@empty\else
|
||||
\setkeys{BCQ@background}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
\registerData{companylogo} % content (image/object) to display instead of company text (company still in vCard)
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@@ -305,33 +337,39 @@ END:VCARD\BCQ@nl}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% insertqrcode - insert the qr-code with optional white background
|
||||
\newcommand\insertqrcode{
|
||||
% Use local overrides if specified, otherwise use global options
|
||||
\ifcsdef{BCQ@qrbgopacity@local}{%
|
||||
\edef\BCQ@qrbgopacity@used{\BCQ@qrbgopacity@local}%
|
||||
}{%
|
||||
\edef\BCQ@qrbgopacity@used{\BCQ@qrbgopacity}%
|
||||
}%
|
||||
\ifcsdef{BCQ@qrlogoscale@local}{%
|
||||
\edef\BCQ@qrlogoscale@used{\BCQ@qrlogoscale@local}%
|
||||
}{%
|
||||
\edef\BCQ@qrlogoscale@used{\BCQ@qrlogoscale}%
|
||||
}%
|
||||
%\frame
|
||||
{
|
||||
\begin{minipage}[c][\heightscale][c]{\imagepercents\textwidth}
|
||||
\begin{tikzpicture}
|
||||
% White background behind QR code (for readability over background images)
|
||||
\node[fill=white, opacity=\fpeval{\BCQ@qrbgopacity}, inner sep=0pt, outer sep=2mm, minimum size=\textwidth] (bg) at (0,0) {};
|
||||
\node[fill=white, opacity=\fpeval{\BCQ@qrbgopacity@used}, inner sep=0pt, outer sep=2mm, minimum size=\textwidth] (bg) at (0,0) {};
|
||||
% QR code on top
|
||||
\node[inner sep=0pt, outer sep=0pt] (qr) at (0,0) {%
|
||||
\ifBCQ@logoinqr
|
||||
% QR code with logo overlay in center
|
||||
\ifcsdef{Xlogo}{%
|
||||
% QR code with optional qrlogo overlay in center
|
||||
\ifcsdef{Xqrlogo}{%
|
||||
\begin{tikzpicture}
|
||||
\node[inner sep=0pt] (qr2) {\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}};
|
||||
% Logo with transparent background preserved (no fill), padding still applied
|
||||
% qrlogoscale and qrlogoborder are now fractions (1.0 = 100%)
|
||||
% qrlogoscale/scale is unitless fraction (0.25 = 25% of QR width)
|
||||
\node[inner sep=\BCQ@qrlogoborder\textwidth] at (qr2.center) {%
|
||||
\includegraphics[width=\BCQ@qrlogoscale\textwidth]{\Xlogo}%
|
||||
\includegraphics[width=\BCQ@qrlogoscale@used\textwidth]{\Xqrlogo}%
|
||||
};
|
||||
\end{tikzpicture}%
|
||||
}{%
|
||||
% No logo defined, just show QR code
|
||||
% No qrlogo defined, just show QR code
|
||||
\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}%
|
||||
}%
|
||||
\else
|
||||
% Standard QR code without overlay
|
||||
\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}%
|
||||
\fi
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\end{minipage}
|
||||
@@ -348,36 +386,46 @@ END:VCARD\BCQ@nl}
|
||||
\ifx\BCQ@logoheight\@empty
|
||||
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
|
||||
\fi
|
||||
% Use local height override if specified, otherwise use global logoheight
|
||||
\ifcsdef{BCQ@logoheight@local}{%
|
||||
\edef\BCQ@logoheight@used{\BCQ@logoheight@local}%
|
||||
}{%
|
||||
\edef\BCQ@logoheight@used{\BCQ@logoheight}%
|
||||
}%
|
||||
% Store logo height as dimension for heightscale calculation
|
||||
\ifcsdef{Xlogo}{%
|
||||
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight}%
|
||||
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight@used}%
|
||||
}{%
|
||||
\setlength{\BCQ@logoheightdimen}{0pt}%
|
||||
}%
|
||||
% Compute heightscale after logo height is known
|
||||
\computeheightscale
|
||||
\ifcsdef{Xlogo}{% logo defined
|
||||
\ifBCQ@logoinqr
|
||||
% Logo in QR code: show name only
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
\else
|
||||
% Logo next to name: two-column layout (logo | name)
|
||||
\begin{minipage}{\textwidth}
|
||||
\begin{minipage}[c]{0.30\textwidth}% logo column
|
||||
\includegraphics[height=\BCQ@logoheight]{\Xlogo}%
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}[c]{0.67\textwidth}% name column
|
||||
\ifBCQ@rightalign\raggedleft\fi% apply alignment
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
\end{minipage}
|
||||
% Logo next to name: two-column layout (logo | name)
|
||||
\begin{minipage}{\textwidth}
|
||||
\begin{minipage}[c]{0.30\textwidth}% logo column
|
||||
\includegraphics[height=\BCQ@logoheight@used]{\Xlogo}%
|
||||
\end{minipage}
|
||||
\fi
|
||||
\hfill
|
||||
\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
|
||||
}%
|
||||
\end{minipage}
|
||||
\end{minipage}
|
||||
}{% no logo: just name
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
% Show companylogo if set (only logo), otherwise show company text
|
||||
\ifcsdef{Xcompanylogo}{%
|
||||
\\\Xcompanylogo% only show logo
|
||||
}{%
|
||||
\ifexists{Xcompany}{\\\Xcompany}% show company text
|
||||
}%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +459,17 @@ END:VCARD\BCQ@nl}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% drawcard - main card with optional background
|
||||
\newcommand\drawcard{
|
||||
% Use local overrides if specified, otherwise use global options
|
||||
\ifcsdef{BCQ@bgscale@local}{%
|
||||
\edef\BCQ@bgscale@used{\BCQ@bgscale@local}%
|
||||
}{%
|
||||
\edef\BCQ@bgscale@used{\BCQ@bgscale}%
|
||||
}%
|
||||
\ifcsdef{BCQ@bgopacity@local}{%
|
||||
\edef\BCQ@bgopacity@used{\BCQ@bgopacity@local}%
|
||||
}{%
|
||||
\edef\BCQ@bgopacity@used{\BCQ@bgopacity}%
|
||||
}%
|
||||
% Handle background
|
||||
\ifcsdef{Xbackground}{%
|
||||
\IfFileExists{\Xbackground}{%
|
||||
@@ -418,8 +477,8 @@ END:VCARD\BCQ@nl}
|
||||
\AddToShipoutPictureBG*{%
|
||||
\AtPageCenter{%
|
||||
\begin{tikzpicture}[overlay]
|
||||
\node[inner sep=0pt, opacity=\fpeval{\BCQ@bgopacity}] at (0,0) {%
|
||||
\includegraphics[height=\fpeval{\BCQ@bgscale}\paperheight]{\Xbackground}%
|
||||
\node[inner sep=0pt, opacity=\fpeval{\BCQ@bgopacity@used}] at (0,0) {%
|
||||
\includegraphics[height=\fpeval{\BCQ@bgscale@used}\paperheight]{\Xbackground}%
|
||||
};
|
||||
\end{tikzpicture}%
|
||||
}%
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
% !TeX program = xelatex
|
||||
\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,logoheight=6em]{businesscard-qrcode}
|
||||
\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.5,logoheight=6em,qrlogoscale=0.5]{businesscard-qrcode}
|
||||
|
||||
\type{home}
|
||||
\givennames{Petra}
|
||||
@@ -13,6 +13,7 @@
|
||||
\email{petra@example.ch}
|
||||
\background{background.png}
|
||||
\logo{photo.png}
|
||||
\qrlogo[scale=.6]{logo.png}
|
||||
|
||||
\begin{document}
|
||||
\drawcard
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Reference in New Issue
Block a user