logo can be an image or a LaTeX element

This commit is contained in:
Marc Wäckerlin
2025-11-11 18:19:29 +01:00
parent 5a8b2d8677
commit f7b9202b31
3 changed files with 19 additions and 4 deletions
+2 -2
View File
@@ -176,8 +176,8 @@ 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[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`. Remember that every logo lowers the QR-code's error-correction margin—keep the scale conservative and always test the code with multiple devices (smartphones plus command-line tools such as `zbarimg`).
- `\logo[height=...]{content}`: supply either a path to an image file (PNG, JPG, PDF, …) or arbitrary LaTeX content (e.g., `\Pacta`). When a readable file exists it is loaded via `\includegraphics`; otherwise the content is typeset as provided. Optional `height` parameter (e.g., `height=6em`) overrides the global `logoheight` option.
- `\qrlogo[scale=...,opacity=...]{content}`: behaves like `\logo`, but places the content in the center of the QR code. Pass an image path or LaTeX markup. Optional parameters: `scale` (fraction like `0.3` for 30% of QR width) overrides `qrlogoscale`, `opacity` (0.0-1.0) overrides `qrbgopacity`. Remember that every logo lowers the QR-code's error-correction margin—keep the scale conservative and always test the code with multiple devices (smartphones plus command-line tools such as `zbarimg`).
- `\companylogo[height=...]{content}`: backwards-compatible helper that still allows arbitrary content below the name. Prefer the new `\company[logo=...]{...}` syntax, but this command remains available.
- `\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`.
+17 -2
View File
@@ -268,6 +268,21 @@
\newcommand\ifboth[3]{\ifcsdef{#1}{\ifcsdef{#2}{#3}{}}{}}
\newcommand\ifany[3]{\ifcsdef{#1}{#3}{\ifcsdef{#2}{#3}{}}}
\newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}}
\newcommand\BCQ@graphiccontent[2]{%
\begingroup
\edef\BCQ@graphicscan{\expandafter\detokenize\expandafter{#1}}%
\IfSubStr{\BCQ@graphicscan}{\string\\}{%
\endgroup #1%
}{%
\xdef\BCQ@graphicspath{\BCQ@graphicscan}%
\endgroup
\IfFileExists{\BCQ@graphicspath}{%
\includegraphics[#2]{\BCQ@graphicspath}%
}{%
#1%
}%
}%
}
% internal boxes and lengths for measuring
\newsavebox{\BCQ@namebox}
@@ -628,7 +643,7 @@ END:VCARD\BCQ@nl}
% Logo with transparent background preserved (no fill), padding still applied
% qrlogoscale/scale is unitless fraction (0.25 = 25% of QR width)
\node[inner sep=\BCQ@qrlogoborder\textwidth] at (qr2.center) {%
\includegraphics[width=\BCQ@qrlogoscale@used\textwidth]{\Xqrlogo}%
\BCQ@graphiccontent{\Xqrlogo}{width=\BCQ@qrlogoscale@used\textwidth}%
};
\end{tikzpicture}%
}{%
@@ -659,7 +674,7 @@ END:VCARD\BCQ@nl}
}%
% Store logo height as dimension for heightscale calculation
\ifcsdef{Xlogo}{%
\sbox{\BCQ@logobox}{\includegraphics[height=\BCQ@logoheight@used]{\Xlogo}}%
\sbox{\BCQ@logobox}{\BCQ@graphiccontent{\Xlogo}{height=\BCQ@logoheight@used}}%
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight@used}%
\setlength{\BCQ@namecolumnwidth}{\dimexpr\textwidth-\wd\BCQ@logobox-\BCQ@logosep\relax}%
}{%
Binary file not shown.