fix LaTeX object in logo

This commit is contained in:
Marc Wäckerlin
2025-11-11 10:53:12 +01:00
parent a4480da3b9
commit dd330d412c
34 changed files with 330 additions and 96 deletions
+35 -7
View File
@@ -65,6 +65,19 @@ Document Structure
where `<layout-options>` and `<data-definitions>` are explained below.
Escaping Spaces in Data
-----------------------
Whitespace inside `\tag{...}` parameters is ignored by TeX when the data is later passed to the QR encoder. To keep literal spaces in the resulting vCard you *must* escape every space with `\ ` inside each data macro:
```latex
\company{Example\ Company\ Ltd.}
\city{New\ York}
\phone{+41\ 44\ 123\ 45\ 67}
```
All examples in this repository follow that convention—when you add your own data, please do the same.
Layout Options
--------------
@@ -111,16 +124,18 @@ Your data is entered with commands in the document, e.g.:
\email{name@example.com}
**Important:**: Spaces *must* be escaped by a backslash `\` in all data definitions, if they should be kept in the QR-Code. This is a limitation of the `qrcode`-package- Without escaping `\`, spaces are show in the text block, but not in the QR-Code. You may make use of this feature, if you do not escape the spaces in `\phone` and `\pgpfingerprint`, but everywhere else. This way, phone number and pgp fingerprint are condensed in the QR-Code.
**Important:** Spaces *must* be escaped by a backslash `\` in all data definitions, otherwise the QR payload will silently drop them. Always write `\company{Example\ Company\ Ltd.}` or `\phone{+41\ 52\ 123\ 45\ 67}`.
See this example_
All data commands accept an optional `[hide]` (or `[hide=true]`) argument. When `hide` is set the value is stored in the QR/vCard only and omitted from the human readable text. Example: `\email[hide]{secret@example.com}` keeps the address available for scanners but off the printed card.
See this example:
\givennames{Juan\ Pablo}
\familynames{Martínez\ Escudero}
\company{Example\ Company\ Ltd.}
\street{Im\ Stutz\ 123}
\pobox{Postfach\ 4567}
\phone{+41 52 123 45 67}
\phone{+41\ 52\ 123\ 45\ 67}
\pgpurl{https://pgp.mit.edu/pks/lookup?op=get\&search=0xF62315D04D4C0C62}
### Recognized Commands:
@@ -130,7 +145,7 @@ See this example_
- `\familynames`: your family names
- `\honoricprefix`: honorix name prefixes, e.g. academic titles
- `\honoricsuffix`: honoric name suffixes
- `\company`: company name — displayed on a second line below the name
- `\company[logo=...,height=...,hide]`: company name — always rendered on a second line underneath the personal name. `logo=` may contain either a filename or arbitrary TeX content (e.g. a custom macro); when present, it is shown first, followed by the textual company/title/role string (if visible). `height` (default `1.5em`) controls the logo's size **and** the reserved vertical space for that second line, so adapting the height keeps the layout balanced. Even when `hide` is set, the company still appears in the QR/vCard, and the logo remains visible.
- `\pobox`: post office box
- `\extaddr`: address extension, e.g. name of a building or floor number
- `\street`: street and number of the address
@@ -160,15 +175,17 @@ See this example_
- `\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`.
- `\companylogo{content}`: arbitrary content (e.g., `\includegraphics[width=3cm]{logo.png}`) displayed instead of company text below name. Company text still appears in vCard.
- `\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`).
- `\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`.
Print the Card
==============
The card is designed for professional printing service, such as [onlineprinters]. Please *check* the card and the *QR-Code* well before you pay money for printing! Choose a format, default is `89mm×59mm` with 2mm boder, so the card content is `85mm×55mm`. But the card can be adapted to any other printing format. To print cards of size `10cm×5cm` with `2mm` cut, you specify, [e.g.](examples/special-papersize.tex):
The card is designed for professional printing service, such as [onlineprinters]. Please *check* the card and the *QR-Code* well before you pay money for printing! Scan the QR with at least one smartphone app **and** a decoder such as `zbarimg businesscard.pdf` on Linux to make sure the payload survives background images, logos in the QR code, etc.
Choose a format, default is `89mm×59mm` with 2mm boder, so the card content is `85mm×55mm`. But the card can be adapted to any other printing format. To print cards of size `10cm×5cm` with `2mm` cut, you specify, [e.g.](examples/special-papersize.tex):
\documentclass[paperheight=5.4cm,paperwidth=10.4cm,
contentheight=5cm,contentwidth=10cm,
@@ -209,6 +226,17 @@ Save it as file [texstudio_d30266.tex] and compile it to get [texstudio_d30266.p
See [examples] for more examples.
### Building with latexmk / IDEs
Editors such as VS Codes LaTeX Workshop usually call `latexmk` from the
workspace root. The repository now ships a project-local `.latexmkrc`
(and `examples/.latexmkrc`) that extend `TEXINPUTS` so TeX always prefers
the class file from this checkout over anything installed under
`~/texmf`. Leave those files in place when compiling from your IDE.
If you invoke `xelatex` manually without `latexmk`, set
`TEXINPUTS=/path/to/businesscard-qrcode:` (or run the command from the
repository root) to achieve the same effect.
Logo (optional)
===============