cleanup and bug fixes

master
Marc Wäckerlin 6 years ago
parent 37f2eb7f0c
commit b489ab733f
  1. 4
      README.md
  2. 19
      businesscard-qrcode/README.md
  3. 183
      businesscard-qrcode/businesscard-qrcode.cls
  4. BIN
      businesscard-qrcode/examples/example.pdf
  5. BIN
      businesscard-qrcode/examples/john-doe-hongkong.pdf
  6. 3
      businesscard-qrcode/examples/john-doe-hongkong.tex
  7. BIN
      businesscard-qrcode/examples/peter-muster-example-company-zuerich.pdf
  8. 2
      businesscard-qrcode/examples/peter-muster-example-company-zuerich.tex
  9. BIN
      businesscard-qrcode/examples/texstudio_d30266.pdf
  10. 2
      businesscard-qrcode/screenshots.sh
  11. BIN
      businesscard-qrcode/screenshots/example.jpg
  12. BIN
      businesscard-qrcode/screenshots/john-doe-hongkong.jpg
  13. BIN
      businesscard-qrcode/screenshots/peter-muster-example-company-zuerich.jpg
  14. BIN
      businesscard-qrcode/screenshots/texstudio_d30266.jpg

@ -1,6 +1,8 @@
LaTeX Templates LaTeX Templates
=============== ===============
- [businesscard-qrcode] - [businesscard-qrcode]: businesscards / visiting cards with QR-Code, ready for printing service
![businesscard-qrcode](businesscard-qrcode/screenshots/peter-muster-example-company-zuerich.jpg)
[businesscard-qrcode]: businesscard-qrcode/README.md "Template for Visiting Cards with QR-Code" [businesscard-qrcode]: businesscard-qrcode/README.md "Template for Visiting Cards with QR-Code"

@ -1,9 +1,9 @@
Businesscard with QR-Code Businesscard with QR-Code
========================= =========================
What happens, if you give someone a visiting card? Either he manually types the text into the mobilefone, or it will end up in a box and be forgotten. Here is the solution: A visiting card with QR-Code, so that it can be scanned with an [app] on the mobilefone and therefore automatically imported into the electronic contacts. This also works well, when yoiu are offline and bluetooth transfer fails. So here os the highly configurable businescard or visitingcards with full VCARD as QR-Code, ready to send to online printers. What happens, if you give your visitin card to someone? Either he manually types the text into his computer or mobilefone, or it will end up in a box and be forgotten. Nowadays data is required electronically, not on paper. Here is the solution: A visiting card with QR-Code that contains a full [vcard], so that it can be scanned with an [app] on the mobilefone and therefore automatically imported into the electronic contacts. This also works well, when you are offline and bluetooth transfer fails. So here is the highly configurable businescard or visitingcards with full [vcard] as QR-Code, ready to send to online printers.
Other available visitingcard templates, such as [mschlenker] distribute the cards on a A4 paper. But if you want a profesional printer, such as [onlineprinters], then you need to be able to generate a PDF with exactly one card, an exactly defined border and crop marks. That's why I wrote this template. Other available visitingcard templates, such as [mschlenker] distribute the cards on an A4 paper. But if you want a professional printer, such as [onlineprinters], then you need to be able to generate a PDF with exactly one card, an exactly defined border and crop marks. That's why I wrote this template: You can specify the exact size of the paper and the content within the paper, inluding generation of crop marks.
[![Example: John Doe from Hongkong](screenshots/john-doe-hongkong.jpg)](examples/john-doe-hongkong.tex) [![Example: John Doe from Hongkong](screenshots/john-doe-hongkong.jpg)](examples/john-doe-hongkong.tex)
[![Example: Businesscard of Peter Muster from Zürich](screenshots/peter-muster-example-company-zuerich.jpg)](examples/peter-muster-example-company-zuerich.tex) [![Example: Businesscard of Peter Muster from Zürich](screenshots/peter-muster-example-company-zuerich.jpg)](examples/peter-muster-example-company-zuerich.tex)
@ -14,11 +14,11 @@ Features
-------- --------
- all information is in the QR-Code - all information is in the QR-Code
- full privacy: input is optional, specify only what you need, you decide what information to share - full privacy control: input is optional, specify only what you need, you decide what information to share, e.g. I print three cards, with phone and address, without address and only with electronical contacts, no phone nor address
- optional icons, optional small hint texts - optional icons, optional small hint texts
- several alignents - several alignments
- freely size of paper and content - freely defined size of paper and content
- supports honoric titles, full names, address woth post office box and extended information - supports honoric titles, full names, address with post office box and extended information
- supports telefone, email, [jabber] and [matrix] chat - supports telefone, email, [jabber] and [matrix] chat
- supports several urls for your hompages - supports several urls for your hompages
- supports [gitea], [github], [git] - supports [gitea], [github], [git]
@ -30,7 +30,7 @@ Features
Usage Example Usage Example
------------- -------------
*Important*: You must use `xelatex` for compilation, because `xelatex` properly supports UTF-8 (e.g. needed for german umlauts or chinese characters). The package `inputenc` messes up with package `qrcode`. **Important:** You must use **`xelatex`** for compilation, because `xelatex` properly supports UTF-8 (e.g. needed for german umlauts or chinese characters). The package `inputenc` messes up with package `qrcode`.
Include the documentclass, define your date and add the document part: Include the documentclass, define your date and add the document part:
@ -91,6 +91,10 @@ Available options:
- `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`
Data Definitions
----------------
Your data is entered as definitions in the document, e.g.: Your data is entered as definitions in the document, e.g.:
\def\email{name@example.com} \def\email{name@example.com}
@ -145,6 +149,7 @@ If you are missing a feature or a configuration option, just open a [ticket] and
[ticket]: https://mrw.sh/templates/latex/issues "open issues and tickets for my LaTeX-templates project" [ticket]: https://mrw.sh/templates/latex/issues "open issues and tickets for my LaTeX-templates project"
[examples]: examples "more examples" [examples]: examples "more examples"
[vcard]: https://tools.ietf.org/html/rfc6350 "RFC 6350, vCard Format Specification Version 4.0"
[app]: https://f-droid.org/de/packages/com.google.zxing.client.android/ "Barcode Scanner" [app]: https://f-droid.org/de/packages/com.google.zxing.client.android/ "Barcode Scanner"
[onlineprinters]: https://de.onlineprinters.ch/k/standardvisitenkarten "onlineprinters.ch" [onlineprinters]: https://de.onlineprinters.ch/k/standardvisitenkarten "onlineprinters.ch"
[mschlenker]: https://gist.github.com/mschlenker/f60e0f15ff1edfc4881c "visitenkarten-qr.tex" [mschlenker]: https://gist.github.com/mschlenker/f60e0f15ff1edfc4881c "visitenkarten-qr.tex"

@ -1,6 +1,8 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesClass{businesscard-qrcode}[2018/08/12 documented and finished in a first version] \ProvidesClass{businesscard-qrcode}[2018/08/13 cleanup and bug fixes]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% option evaluation
\RequirePackage{kvoptions} \RequirePackage{kvoptions}
\SetupKeyvalOptions{ \SetupKeyvalOptions{
family=BCQ, family=BCQ,
@ -33,14 +35,12 @@
\DeclareComplementaryOption{textfirst}{qrfirst} \DeclareComplementaryOption{textfirst}{qrfirst}
\DeclareBoolOption[true]{https} \DeclareBoolOption[true]{https}
\DeclareComplementaryOption{www}{https} \DeclareComplementaryOption{www}{https}
\DeclareDefaultOption{\@unknownoptionerror} \DeclareDefaultOption{\@unknownoptionerror}
\ProcessKeyvalOptions* \ProcessKeyvalOptions*
%\ProcessOptions\relax
\LoadClass[\BCQ@fontsize]{extarticle}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% definitions from the options
\def\content{paperwidth=\BCQ@contentwidth,paperheight=\BCQ@contentheight} \def\content{paperwidth=\BCQ@contentwidth,paperheight=\BCQ@contentheight}
\def\papersize{width=\BCQ@paperwidth,height=\BCQ@paperheight} \def\papersize{width=\BCQ@paperwidth,height=\BCQ@paperheight}
\def\padding{\BCQ@padding} % padding around the content \def\padding{\BCQ@padding} % padding around the content
@ -53,6 +53,30 @@
\def\protprefix{\ifBCQ@https https://\fi} \def\protprefix{\ifBCQ@https https://\fi}
\ifBCQ@address\def\printaddress{}\fi \ifBCQ@address\def\printaddress{}\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% global dependencies and settings
\LoadClass[\BCQ@fontsize]{extarticle}
\RequirePackage{marvosym}
\RequirePackage{fontawesome}
\RequirePackage[final]{qrcode}
\RequirePackage{etoolbox}
\RequirePackage{DejaVuSans}
\RequirePackage[T1]{fontenc}
\RequirePackage{wrapfig}
\RequirePackage[\content,top=\padding,left=\padding,right=\padding,bottom=\padding]{geometry}
%\RequirePackage{pbox}
\RequirePackage{varwidth}
\RequirePackage{calc}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\renewcommand*\familydefault{\sfdefault}
\setlength{\fboxsep}{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% auxiliary commands
\newcommand\enforceright{\leftskip0pt plus 1fill\rightskip0pt}
\newcommand\exec[1]{\csname #1\endcsname} \newcommand\exec[1]{\csname #1\endcsname}
\newcommand\insa[3][]{\ifcsdef{#2}{ \newcommand\insa[3][]{\ifcsdef{#2}{
@ -66,9 +90,16 @@
\newcommand\ifboth[3]{\ifcsdef{#1}{\ifcsdef{#2}{#3}{}}{}} \newcommand\ifboth[3]{\ifcsdef{#1}{\ifcsdef{#2}{#3}{}}{}}
\newcommand\ifany[3]{\ifcsdef{#1}{#3}{\ifcsdef{#2}{#3}{}}} \newcommand\ifany[3]{\ifcsdef{#1}{#3}{\ifcsdef{#2}{#3}{}}}
\newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}} \newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}}
\newcommand\heightscale{\dimexpr\textheight-\ifcsempty{name}{0em}{2em}-\ifcsdef{pgpfingerprint}{2em}{0em}-\ifcsdef{additionalnames}{2em}{0em}\relax}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% name - assemble full name from the parts, such as givennames and familynames
\newcommand\name{\ifexists{honoricprefix}{\honoricprefix\ }\ifexists{givennames}{\givennames\ }\ifexists{familynames}{\familynames}\ifexists{honoricsuffix}{\ \honoricsuffix}} \newcommand\name{\ifexists{honoricprefix}{\honoricprefix\ }\ifexists{givennames}{\givennames\ }\ifexists{familynames}{\familynames}\ifexists{honoricsuffix}{\ \honoricsuffix}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% vcard - the content of the vcard
\newcommand\vcard{BEGIN:VCARD^^J \newcommand\vcard{BEGIN:VCARD^^J
VERSION:4.0^^J VERSION:4.0^^J
N:\cond{familynames};\cond{givennames};\cond{additionalnames};\cond{honoricprefix};\cond{honoricsuffix}^^J N:\cond{familynames};\cond{givennames};\cond{additionalnames};\cond{honoricprefix};\cond{honoricsuffix}^^J
@ -97,9 +128,9 @@ FN:\name\ifexists{additionalnames}{\ifcsempty{name}{}{\ }\additionalnames}^^J
\ifexists{pgpfingerprint}{KEY:data:application/x-pgp-fingerprint,\pgpfingerprint^^J} \ifexists{pgpfingerprint}{KEY:data:application/x-pgp-fingerprint,\pgpfingerprint^^J}
END:VCARD^^J} END:VCARD^^J}
\RequirePackage{marvosym}
\RequirePackage{fontawesome}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% address - the address as shown in the textbox
\newcommand\address{ \newcommand\address{
\cond{pobox} \cond{pobox}
@ -114,87 +145,101 @@ END:VCARD^^J}
} }
\RequirePackage{pbox}
\RequirePackage{calc}
\newcommand\enforceright{\leftskip0pt plus 1fill\rightskip0pt}
\newcommand\data{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifexists{printaddress}{ % inserttext - assemble the textbox
\ifBCQ@iconleft \newcommand\inserttext{
\ifBCQ@icon\parbox[c]{1em}{\faMapMarker}\ \ifBCQ@fill\hfill\fi\fi %\frame
\pbox[t]{\dimexpr\textwidth-2em\relax}{\ifBCQ@rightalign\enforceright\fi\address} {
\else \begin{minipage}[c][\heightscale][c]{\textpercents\textwidth}
\pbox[t]{\dimexpr\textwidth-2em\relax}{\ifBCQ@rightalign\enforceright\fi\address} \ifBCQ@rightalign\begin{flushright}\fi
\ifBCQ@icon\ifBCQ@fill\hfill\fi\ \parbox[c]{1em}{\faMapMarker}\fi \ifexists{printaddress}{
\fi \ifBCQ@iconleft
\vspace{1em} \ifBCQ@icon\parbox[c]{1em}{\faMapMarker}\ \ifBCQ@fill\hfill\fi\fi
} %\frame{
%\pbox[t]{\dimexpr\textwidth-2em\relax}{
\begin{varwidth}{\dimexpr\textwidth-2em\relax}
\ifBCQ@rightalign\enforceright\fi\address
\end{varwidth}
%}
%}
\else
%\pbox[t]{\dimexpr\textwidth-2em\relax}{
\begin{varwidth}{\dimexpr\textwidth-2em\relax}
\ifBCQ@rightalign\enforceright\fi\address
\end{varwidth}
%}
\ifBCQ@icon\ifBCQ@fill\hfill\fi\ \parbox[c]{1em}{\faMapMarker}\fi
\fi
\vspace{1em}
}
\insa[tel:]{phone}{faMobile}\insa[mailto:]{email}{Email}\insa[xmpp]{jabber}{faCommentsO}\insa[matrix.org]{matrixorg}{faCommentsO}\insa[nextcloud-id]{cloud}{faCloud}\insa[\protdisplay]{homepage}{faHome}\insa[\protdisplay]{wordpress}{faWordpress}\insa[\protdisplay]{drupal}{faDrupal}\insa[\protdisplay]{joomla}{faJoomla}\insa[{\protprefix}\lang.wikipedia.org/wiki/]{wikipedia}{faWikipediaW}\insa[\protdisplay]{link}{faLink}\insa[\protdisplay]{world}{faGlobe}\insa[\protdisplay]{git}{faGit}\insa[\protdisplay]{gitea}{faGithubAlt}\insa[{\protprefix}github.com/]{github}{faGithub}\insa[{\protprefix}facebook.com/]{facebook}{faFacebook}\insa[{\protprefix}twitter.com/]{twitter}{faTwitter}\insa[{\protprefix}youtube.com/user/]{youtube}{faYoutube}\insa[{\protprefix}plus.google.com/+]{google}{faGooglePlus} \insa[tel:]{phone}{faMobile}\insa[mailto:]{email}{Email}\insa[xmpp]{jabber}{faCommentsO}\insa[matrix.org]{matrixorg}{faCommentsO}\insa[nextcloud-id]{cloud}{faCloud}\insa[\protdisplay]{homepage}{faHome}\insa[\protdisplay]{wordpress}{faWordpress}\insa[\protdisplay]{drupal}{faDrupal}\insa[\protdisplay]{joomla}{faJoomla}\insa[{\protprefix}\lang.wikipedia.org/wiki/]{wikipedia}{faWikipediaW}\insa[\protdisplay]{link}{faLink}\insa[\protdisplay]{world}{faGlobe}\insa[\protdisplay]{git}{faGit}\insa[\protdisplay]{gitea}{faGithubAlt}\insa[{\protprefix}github.com/]{github}{faGithub}\insa[{\protprefix}facebook.com/]{facebook}{faFacebook}\insa[{\protprefix}twitter.com/]{twitter}{faTwitter}\insa[{\protprefix}youtube.com/user/]{youtube}{faYoutube}\insa[{\protprefix}plus.google.com/+]{google}{faGooglePlus}
}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\RequirePackage[final]{qrcode} \ifBCQ@rightalign\end{flushright}\fi
\RequirePackage{etoolbox} \end{minipage}
}
\RequirePackage{DejaVuSans} }
\renewcommand*\familydefault{\sfdefault}
\RequirePackage[T1]{fontenc}
\RequirePackage{wrapfig}
\RequirePackage[\content,top=\padding,left=\padding,right=\padding,bottom=\padding]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% insertqrcode - insert the qr-code
\newcommand\insertqrcode{ \newcommand\insertqrcode{
\qrcode[level=Q,version=0,height=\textwidth]{\vcard} %\frame
{
\begin{minipage}[c][\heightscale][c]{\imagepercents\textwidth}
\qrcode[level=Q,version=0,height=\textwidth]{\vcard}
\end{minipage}
} }
\newcommand\inserttext{
\data
} }
\newcommand\drawcard{
\ifBCQ@rightalign\raggedleft\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\heightscale{\dimexpr\textheight-\ifcsempty{name}{0em}{2em}-\ifcsdef{pgpfingerprint}{2em}{0em}-\ifcsdef{additionalnames}{2em}{0em}\relax} % insertname - insert the name on the top
{\bfseries \newcommand\insertname{
%\frame
%\begin{minipage}{\textwidth}
%\pbox[t]{0.9\textwidth}
{\bfseries
\cond{name} \cond{name}
\cond{additionalnames} \cond{additionalnames}
} }
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}} %\end{minipage}
\vfill }
\ifBCQ@qrfirst
\begin{minipage}[c][\heightscale][c]{\imagepercents\textwidth} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% drawcard - assemble all blocks into the visiting card
\newcommand\drawcard{
\ifBCQ@rightalign\begin{flushright}\fi
\insertname
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}} % horizontal line
\vfill
\ifBCQ@qrfirst
\insertqrcode \insertqrcode
\end{minipage} \hfill
\hfill
\begin{minipage}[c][\heightscale][c]{\textpercents\textwidth}
\inserttext \inserttext
\end{minipage} \else
\else
\begin{minipage}[c][\heightscale][c]{\textpercents\textwidth}
\inserttext \inserttext
\end{minipage} \hfill
\hfill
\begin{minipage}[c][\heightscale][c]{\imagepercents\textwidth}
\insertqrcode \insertqrcode
\end{minipage}
\fi
\ifexists{pgpfingerprint}{
\vfill
\ifBCQ@iconleft
\faLock\ifBCQ@hint{\tiny\ pgp}\fi\hfill{\small\pgpfingerprint}
\else
{\small\pgpfingerprint}\hfill\ifBCQ@hint{\tiny{pgp\ }}\fi\faLock
\fi \fi
} \ifexists{pgpfingerprint}{
\vfill
\ifBCQ@iconleft
\faLock\ifBCQ@hint{\tiny\ pgp}\fi\hfill{\small\pgpfingerprint}
\else
{\small\pgpfingerprint}\hfill\ifBCQ@hint{\tiny{pgp\ }}\fi\faLock
\fi
}
\ifBCQ@rightalign\end{flushright}\fi
} }
% crop marks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cut / crop marks
\RequirePackage[\papersize,noinfo,center,pdftex]{crop} \RequirePackage[\papersize,noinfo,center,pdftex]{crop}
\newcommand\tl{ \newcommand\tl{
\begin{picture}(0,0) \begin{picture}(0,0)

@ -1,4 +1,4 @@
\documentclass[nohint,fontsize=9pt]{businesscard-qrcode} \documentclass[nofill,leftalign,nohint,fontsize=9pt]{businesscard-qrcode}
\def\givennames{John} \def\givennames{John}
\def\familynames{Doe} \def\familynames{Doe}
@ -10,6 +10,7 @@
\def\homepage{example.com} \def\homepage{example.com}
\def\email{name@example.com} \def\email{name@example.com}
\begin{document} \begin{document}
\drawcard \drawcard
\end{document} \end{document}

@ -1,4 +1,4 @@
\documentclass[nohint,textwidth=0.55,leftalign,nofill]{businesscard-qrcode} \documentclass[nohint,textwidth=0.55,rightalign,nofill]{businesscard-qrcode}
\def\type{work} \def\type{work}
\def\givennames{Peter} \def\givennames{Peter}

@ -2,5 +2,5 @@
for f in examples/*.pdf; do for f in examples/*.pdf; do
s=${f##*/}; s=${f##*/};
convert -density 300 $f screenshots/${s%pdf}jpg; convert -density 600 -quality 90 $f screenshots/${s%pdf}jpg;
done done

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Loading…
Cancel
Save