fix LaTeX object in logo
This commit is contained in:
+240
-70
@@ -93,10 +93,53 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% data registration
|
||||
\newcommand\registerData[1]{
|
||||
\expandafter\newcommand\csname #1\endcsname[1]{
|
||||
\expandafter\def\csname X#1\endcsname{##1}
|
||||
}
|
||||
\newcommand\BCQ@datareset{%
|
||||
\def\BCQ@data@hide{}%
|
||||
\def\BCQ@data@logo{}%
|
||||
\def\BCQ@data@height{}%
|
||||
}
|
||||
\define@key{BCQ@data}{hide}[true]{%
|
||||
\edef\BCQ@data@hide{#1}%
|
||||
}
|
||||
\define@key{BCQ@data}{logo}{%
|
||||
\def\BCQ@data@logo{#1}%
|
||||
}
|
||||
\define@key{BCQ@data}{height}{%
|
||||
\def\BCQ@data@height{#1}%
|
||||
}
|
||||
\newlength{\BCQ@companybrandingheight}
|
||||
\setlength{\BCQ@companybrandingheight}{2em}
|
||||
\newcommand\BCQ@applycompanyoptions{%
|
||||
\csundef{Xcompanylogo}%
|
||||
\csundef{Xcompanylogoheight}%
|
||||
\setlength{\BCQ@companybrandingheight}{2em}%
|
||||
\ifx\BCQ@data@logo\@empty\else
|
||||
\let\Xcompanylogo\BCQ@data@logo
|
||||
\ifx\BCQ@data@height\@empty
|
||||
\def\Xcompanylogoheight{1.5em}%
|
||||
\else
|
||||
\def\Xcompanylogoheight{\BCQ@data@height}%
|
||||
\fi
|
||||
\setlength{\BCQ@companybrandingheight}{\Xcompanylogoheight}%
|
||||
\fi
|
||||
}
|
||||
\newcommand\registerData[1]{%
|
||||
\expandafter\newcommand\csname #1\endcsname[2][]{%
|
||||
\BCQ@datareset
|
||||
\edef\BCQ@data@options{##1}%
|
||||
\ifx\BCQ@data@options\@empty\else
|
||||
\setkeys{BCQ@data}{##1}%
|
||||
\fi
|
||||
\csundef{X#1@hide}%
|
||||
\ifx\BCQ@data@hide\@empty\else
|
||||
\edef\BCQ@data@hidetmp{\BCQ@data@hide}%
|
||||
\ifdefstring{\BCQ@data@hidetmp}{false}{}{%
|
||||
\expandafter\def\csname X#1@hide\endcsname{true}%
|
||||
}%
|
||||
\fi
|
||||
\expandafter\def\csname X#1\endcsname{##2}%
|
||||
\ifstrequal{#1}{company}{\BCQ@applycompanyoptions}{}%
|
||||
}%
|
||||
}
|
||||
\registerData{type}
|
||||
\registerData{givennames}
|
||||
@@ -178,12 +221,38 @@
|
||||
|
||||
\registerData{companylogo} % content (image/object) to display instead of company text (company still in vCard)
|
||||
|
||||
\define@key{BCQ@companylogo}{height}{%
|
||||
\def\BCQ@companylogo@height{#1}%
|
||||
}
|
||||
\renewcommand\companylogo[2][]{%
|
||||
\def\BCQ@companylogo@height{}%
|
||||
\edef\BCQ@companylogo@options{#1}%
|
||||
\ifx\BCQ@companylogo@options\@empty\else
|
||||
\setkeys{BCQ@companylogo}{#1}%
|
||||
\fi
|
||||
\def\Xcompanylogo{#2}%
|
||||
\ifx\BCQ@companylogo@height\@empty
|
||||
\def\Xcompanylogoheight{1.5em}%
|
||||
\else
|
||||
\def\Xcompanylogoheight{\BCQ@companylogo@height}%
|
||||
\fi
|
||||
\setlength{\BCQ@companybrandingheight}{\Xcompanylogoheight}%
|
||||
}
|
||||
|
||||
\newcommand\ifvisible[3]{%
|
||||
\ifcsdef{#1}{%
|
||||
\ifcsdef{#1@hide}{#3}{#2}%
|
||||
}{#3}%
|
||||
}
|
||||
\newcommand\conddisplay[1]{%
|
||||
\ifvisible{#1}{\exec{#1}}{}%
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% auxiliary commands
|
||||
\newcommand\enforceright{\leftskip0pt plus 1fill\rightskip0pt}
|
||||
\newcommand\exec[1]{\csname #1\endcsname}
|
||||
\newcommand\insa[3][]{\ifcsdef{#2}{
|
||||
\newcommand\insa[3][]{\ifvisible{#2}{
|
||||
|
||||
\ifBCQ@iconleft
|
||||
\ifBCQ@icon\parbox{1em}{\centering\exec{#3}}\ \fi\ifBCQ@hint{\tiny#1}\fi\ifBCQ@fill\hfill\fi\exec{#2}
|
||||
@@ -210,37 +279,64 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
|
||||
\newcommand\personalname{%
|
||||
\newcommand\personalnamevcard{%
|
||||
\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }%
|
||||
\ifexists{Xgivennames}{\Xgivennames\ }%
|
||||
\ifexists{Xadditionalnames}{\Xadditionalnames\ }%
|
||||
\ifexists{Xfamilynames}{\Xfamilynames}%
|
||||
\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}%
|
||||
}
|
||||
\newcommand\personalname{%
|
||||
\ifvisible{Xhonoricprefix}{\Xhonoricprefix\ }{}%
|
||||
\ifvisible{Xgivennames}{\Xgivennames\ }{}%
|
||||
\ifvisible{Xadditionalnames}{\Xadditionalnames\ }{}%
|
||||
\ifvisible{Xfamilynames}{\Xfamilynames}{}%
|
||||
\ifvisible{Xhonoricsuffix}{\ \Xhonoricsuffix}{}%
|
||||
}
|
||||
\newcommand\ifhaspersonalname[2]{%
|
||||
\ifcsdef{Xhonoricprefix}{#1}{%
|
||||
\ifcsdef{Xgivennames}{#1}{%
|
||||
\ifcsdef{Xadditionalnames}{#1}{%
|
||||
\ifcsdef{Xfamilynames}{#1}{%
|
||||
\ifcsdef{Xhonoricsuffix}{#1}{#2}%
|
||||
\ifvisible{Xhonoricprefix}{#1}{%
|
||||
\ifvisible{Xgivennames}{#1}{%
|
||||
\ifvisible{Xadditionalnames}{#1}{%
|
||||
\ifvisible{Xfamilynames}{#1}{%
|
||||
\ifvisible{Xhonoricsuffix}{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\newcommand\ifhasposition[2]{%
|
||||
\ifcsdef{Xcompany}{#1}{%
|
||||
\ifcsdef{Xtitle}{#1}{%
|
||||
\ifcsdef{Xrole}{#1}{#2}%
|
||||
\newcommand\ifhaspositiontext[2]{%
|
||||
\ifvisible{Xcompany}{#1}{%
|
||||
\ifvisible{Xtitle}{#1}{%
|
||||
\ifvisible{Xrole}{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\newcommand\ifhaspositionblock[2]{%
|
||||
\ifhaspositiontext{#1}{%
|
||||
\ifcsdef{Xcompanylogo}{#1}{#2}%
|
||||
}%
|
||||
}
|
||||
\newcommand\ifhaspersonalnamevcard[2]{%
|
||||
\ifcsname Xhonoricprefix\endcsname
|
||||
#1%
|
||||
\else\ifcsname Xgivennames\endcsname
|
||||
#1%
|
||||
\else\ifcsname Xadditionalnames\endcsname
|
||||
#1%
|
||||
\else\ifcsname Xfamilynames\endcsname
|
||||
#1%
|
||||
\else\ifcsname Xhonoricsuffix\endcsname
|
||||
#1%
|
||||
\else
|
||||
#2%
|
||||
\fi\fi\fi\fi\fi
|
||||
}
|
||||
|
||||
% heightscale - calculate available height for text/QR
|
||||
% Uses actual logo height if logo is taller than default reserved space
|
||||
% This is computed as a length and stored, not a macro
|
||||
\newcommand\computeheightscale{%
|
||||
\setlength{\BCQ@reservedheight}{\dimexpr\ifhaspersonalname{2em}{0em}+\ifhasposition{2em}{0em}\relax}%
|
||||
\setlength{\BCQ@reservedheight}{\dimexpr\ifhaspersonalname{2em}{0em}+\ifhaspositionblock{\BCQ@companybrandingheight}{0pt}\relax}%
|
||||
\ifdim\BCQ@logoheightdimen>\BCQ@reservedheight
|
||||
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
|
||||
\else
|
||||
@@ -249,28 +345,87 @@
|
||||
}
|
||||
\newcommand\heightscale{\BCQ@heightscale}
|
||||
|
||||
\newcommand\companyrolestring{%
|
||||
\ifcsdef{Xtitle}{\Xtitle}{}%
|
||||
\ifcsdef{Xrole}{%
|
||||
\ifcsdef{Xtitle}{, }{}%
|
||||
\newcommand\companyrolestringdisplay{%
|
||||
\ifvisible{Xtitle}{\Xtitle}{}%
|
||||
\ifvisible{Xrole}{%
|
||||
\ifvisible{Xtitle}{, }{}%
|
||||
\Xrole
|
||||
}{}%
|
||||
\ifcsdef{Xcompany}{%
|
||||
\ifcsdef{Xtitle}{\ \Xcompany}{%
|
||||
\ifcsdef{Xrole}{\ \Xcompany}{\Xcompany}%
|
||||
\ifvisible{Xcompany}{%
|
||||
\ifvisible{Xtitle}{\ \Xcompany}{%
|
||||
\ifvisible{Xrole}{\ \Xcompany}{\Xcompany}%
|
||||
}%
|
||||
}{}%
|
||||
}
|
||||
\newcommand\name{%
|
||||
\personalname
|
||||
\ifhasposition{%
|
||||
\ifhaspersonalname{%
|
||||
\ (\companyrolestring)%
|
||||
}{%
|
||||
\companyrolestring
|
||||
}%
|
||||
\newcommand\companybrandingline{%
|
||||
\ifcsdef{Xcompanylogo}{\companylogocontent}{}%
|
||||
\ifhaspositiontext{%
|
||||
\ifcsdef{Xcompanylogo}{\hspace{0.5em}}{}%
|
||||
\companyrolestringdisplay
|
||||
}{}%
|
||||
}
|
||||
\newcommand\companyrolestringvcard{%
|
||||
\ifcsname Xtitle\endcsname
|
||||
\Xtitle
|
||||
\fi
|
||||
\ifcsname Xrole\endcsname
|
||||
\ifcsname Xtitle\endcsname , \fi
|
||||
\Xrole
|
||||
\fi
|
||||
\ifcsname Xcompany\endcsname
|
||||
\ifcsname Xtitle\endcsname
|
||||
\ \Xcompany
|
||||
\else
|
||||
\ifcsname Xrole\endcsname
|
||||
\ \Xcompany
|
||||
\else
|
||||
\Xcompany
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
\newcommand\displayname{%
|
||||
\ifhaspersonalname{\personalname}{\companybrandingline}%
|
||||
}
|
||||
\newcommand\BCQ@appendvcardposition{%
|
||||
\ifhaspersonalnamevcard{%
|
||||
\ (\companyrolestringvcard)%
|
||||
}{%
|
||||
\companyrolestringvcard
|
||||
}%
|
||||
}
|
||||
\newcommand\BCQ@buildname{%
|
||||
\ifhaspersonalnamevcard{%
|
||||
\personalnamevcard
|
||||
\ifcsname Xtitle\endcsname
|
||||
\BCQ@appendvcardposition
|
||||
\else
|
||||
\ifcsname Xrole\endcsname
|
||||
\BCQ@appendvcardposition
|
||||
\else
|
||||
\ifcsname Xcompany\endcsname
|
||||
\BCQ@appendvcardposition
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}{%
|
||||
\companyrolestringvcard
|
||||
}%
|
||||
}
|
||||
\let\BCQ@cachedname\@empty
|
||||
\newcommand\BCQ@setnamecache{%
|
||||
\begingroup
|
||||
\edef\BCQ@tmp{\BCQ@buildname}%
|
||||
\global\let\BCQ@cachedname\BCQ@tmp
|
||||
\endgroup
|
||||
}
|
||||
\newcommand\name{%
|
||||
\ifx\BCQ@cachedname\@empty
|
||||
\BCQ@buildname
|
||||
\else
|
||||
\BCQ@cachedname
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@@ -318,35 +473,42 @@ 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}%
|
||||
\ifvisible{Xcountry}{%
|
||||
\def\BCQ@shouldinline{false}%
|
||||
\def\BCQ@haszipcity{false}%
|
||||
\ifvisible{Xcity}{\def\BCQ@haszipcity{true}}{}%
|
||||
\ifvisible{Xzip}{\def\BCQ@haszipcity{true}}{}%
|
||||
% Check countryformat option
|
||||
\ifdefstring{\BCQ@countryformat}{inline}{%
|
||||
\def\BCQ@shouldinline{true}%
|
||||
}{%
|
||||
% 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%
|
||||
\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
|
||||
\ifdefstring{\BCQ@haszipcity}{true}{%
|
||||
\def\BCQ@shouldinline{true}%
|
||||
}{}%
|
||||
\fi%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
% Output country
|
||||
\ifdefstring{\BCQ@shouldinline}{true}{%
|
||||
\Xcountry\ \textemdash\ \cond{Xzip} \cond{Xcity}%
|
||||
}{%
|
||||
\cond{Xzip} \cond{Xcity}
|
||||
% Output country
|
||||
\ifdefstring{\BCQ@shouldinline}{true}{%
|
||||
\Xcountry\ \textemdash\ \conddisplay{Xzip} \conddisplay{Xcity}%
|
||||
}{%
|
||||
\conddisplay{Xzip} \conddisplay{Xcity}
|
||||
|
||||
\Xcountry
|
||||
|
||||
\Xcountry
|
||||
|
||||
}%
|
||||
}{%
|
||||
\conddisplay{Xzip} \conddisplay{Xcity}%
|
||||
}%
|
||||
}{
|
||||
\cond{Xzip} \cond{Xcity}
|
||||
\conddisplay{Xzip} \conddisplay{Xcity}%
|
||||
}%
|
||||
}
|
||||
|
||||
@@ -354,15 +516,15 @@ END:VCARD\BCQ@nl}
|
||||
% address - the address as shown in the textbox
|
||||
\newcommand\address{
|
||||
|
||||
\cond{Xpobox}
|
||||
\conddisplay{Xpobox}
|
||||
|
||||
\cond{Xextaddr}
|
||||
\conddisplay{Xextaddr}
|
||||
|
||||
\cond{Xstreet}
|
||||
\conddisplay{Xstreet}
|
||||
|
||||
\formatcountry
|
||||
|
||||
\cond{Xregion}
|
||||
\conddisplay{Xregion}
|
||||
|
||||
}
|
||||
|
||||
@@ -450,7 +612,7 @@ END:VCARD\BCQ@nl}
|
||||
% insertname - insert the name on the top
|
||||
\newcommand\insertname{
|
||||
% typeset name into box for measurement
|
||||
\sbox{\BCQ@namebox}{\bfseries\cond{name}}%
|
||||
\sbox{\BCQ@namebox}{\bfseries\cond{displayname}}%
|
||||
% Set default logoheight if not specified: 4em with company, 2em without
|
||||
\ifx\BCQ@logoheight\@empty
|
||||
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
|
||||
@@ -486,21 +648,24 @@ END:VCARD\BCQ@nl}
|
||||
\hspace{\BCQ@logosepused}
|
||||
\begin{minipage}[c]{\BCQ@namewidth}% name column
|
||||
\ifBCQ@rightalign\raggedleft\fi% apply alignment
|
||||
{\bfseries\cond{name}}%
|
||||
% Optional company logo below name
|
||||
\ifcsdef{Xcompanylogo}{\\\companylogocontent}{}%
|
||||
{\bfseries\cond{displayname}}%
|
||||
\ifhaspersonalname{%
|
||||
\ifhaspositionblock{\\\companybrandingline}{}%
|
||||
}{}%
|
||||
\end{minipage}
|
||||
\end{minipage}
|
||||
}{% no logo: just name
|
||||
{\bfseries\cond{name}}%
|
||||
% Optional company logo below name
|
||||
\ifcsdef{Xcompanylogo}{\\\companylogocontent}{}%
|
||||
{\bfseries\cond{displayname}}%
|
||||
\ifhaspersonalname{%
|
||||
\ifhaspositionblock{\\\companybrandingline}{}%
|
||||
}{}%
|
||||
}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% drawcardcontent - assemble all blocks (name, text, qr, pgp)
|
||||
\newcommand\drawcardcontent{
|
||||
\BCQ@setnamecache
|
||||
\ifBCQ@rightalign\begin{flushright}\fi
|
||||
\insertname
|
||||
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}} % horizontal line
|
||||
@@ -597,14 +762,19 @@ END:VCARD\BCQ@nl}
|
||||
\crop[cut]
|
||||
\newcommand\companylogocontent{%
|
||||
\begingroup
|
||||
\edef\BCQ@companylogomeaning{\meaning\Xcompanylogo}%
|
||||
\IfSubStr{\BCQ@companylogomeaning}{\string\\}{%
|
||||
\edef\BCQ@companylogoscan{\expandafter\detokenize\expandafter{\Xcompanylogo}}%
|
||||
\IfSubStr{\BCQ@companylogoscan}{\string\\}{%
|
||||
\endgroup
|
||||
\Xcompanylogo
|
||||
}{%
|
||||
\xdef\BCQ@companylogopath{\BCQ@companylogoscan}%
|
||||
\endgroup
|
||||
\IfFileExists{\Xcompanylogo}{%
|
||||
\includegraphics[width=\linewidth]{\Xcompanylogo}%
|
||||
\IfFileExists{\BCQ@companylogopath}{%
|
||||
\edef\BCQ@companylogoheightused{1.5em}%
|
||||
\ifcsdef{Xcompanylogoheight}{%
|
||||
\edef\BCQ@companylogoheightused{\Xcompanylogoheight}%
|
||||
}{}%
|
||||
\includegraphics[height=\BCQ@companylogoheightused]{\BCQ@companylogopath}%
|
||||
}{%
|
||||
\Xcompanylogo
|
||||
}%
|
||||
|
||||
Reference in New Issue
Block a user