Dynamic Logo Counter
This commit is contained in:
parent
349a7e9c22
commit
80698b3f16
@ -41,7 +41,6 @@
|
||||
%----------------------------------------
|
||||
\RequirePackage[ngerman]{babel}
|
||||
\RequirePackage{lmodern}
|
||||
\RequirePackage{amsmath}
|
||||
\RequirePackage{graphicx}
|
||||
\RequirePackage{svg}
|
||||
\RequirePackage[T1]{fontenc}
|
||||
@ -50,6 +49,9 @@
|
||||
\RequirePackage{fancyhdr}
|
||||
\RequirePackage{bophook}
|
||||
\RequirePackage{ifthen}
|
||||
\RequirePackage{arrayjobx}
|
||||
\RequirePackage{etoolbox}
|
||||
\RequirePackage{transparent}
|
||||
|
||||
%----------------------------------------
|
||||
% REFS
|
||||
@ -123,57 +125,43 @@
|
||||
%----------------------------------------
|
||||
|
||||
% ==== Add more logos to be placed besides the main logo on the title page ====
|
||||
\newcommand{\titlePageLogosArray}{}
|
||||
\newcommand{\footerLogosArray}{}
|
||||
\newcommand{\logosScale}{1}
|
||||
\newcommand{\mainLogoScale}{1}
|
||||
|
||||
\newlength{\imageHeight}
|
||||
|
||||
\newcounter{logoCounter}
|
||||
\setcounter{logoCounter}{1}
|
||||
|
||||
\DeclareRobustCommand{\SetLogosScale}[1]{
|
||||
\renewcommand{\logosScale}{#1}
|
||||
}
|
||||
|
||||
\DeclareRobustCommand{\AddLogo}[5]{
|
||||
\appto{\titlePageLogosArray}{
|
||||
\node[anchor=west, xshift=0.5cm] (logo#4) at (logo#5.east) {
|
||||
\setlength{\imageHeight}{1.5cm*\real{#2}*\real{\logosScale}}
|
||||
\StrBehind{#1}{.}[\fileExtension]
|
||||
\strcompare{\fileExtension}{svg}{
|
||||
\includesvg[height=\imageHeight]{#1}
|
||||
}{
|
||||
\includegraphics[height=\imageHeight]{#1}
|
||||
}
|
||||
};
|
||||
\filldraw[white, opacity=#3] (logo#4.north east) rectangle (logo#4.south west);
|
||||
}
|
||||
\let\newglobalarray\newarray
|
||||
\patchcmd{\newglobalarray}{\edef}{\xdef}{}{}
|
||||
|
||||
\appto{\footerLogosArray}{
|
||||
\node[anchor=east, xshift=-0.1cm] (logo#4) at (logo#5.west) {
|
||||
\setlength{\imageHeight}{1.5cm*\real{#2}*\real{0.55}*\real{\logosScale}}
|
||||
\StrBehind{#1}{.}[\fileExtension]
|
||||
\strcompare{\thepage}{1}{}{
|
||||
\strcompare{\fileExtension}{svg}{
|
||||
\includesvg[height=\imageHeight]{#1}
|
||||
}{
|
||||
\includegraphics[height=\imageHeight]{#1}
|
||||
}
|
||||
}
|
||||
};
|
||||
\filldraw[white, opacity=#3] (logo#4.north east) rectangle (logo#4.south west);
|
||||
}
|
||||
% AddLogo Command with automatic counter
|
||||
% Array to store the logos and to be used in pgffor later
|
||||
\newglobalarray\LogosPaths
|
||||
\newglobalarray\LogosScales
|
||||
\newglobalarray\LogosOpacities
|
||||
\newglobalarray\LogosExtensions
|
||||
\newcounter{logoCounter}
|
||||
\setcounter{logoCounter}{0}
|
||||
\expandarrayelementtrue
|
||||
% Command to add a logo to the array
|
||||
% Usage: \AddLogoToArray{<Name>}{<Scale>}{<Opacity>}
|
||||
\DeclareRobustCommand{\AddLogo}[4]{
|
||||
\stepcounter{logoCounter}
|
||||
\LogosPaths(\thelogoCounter)={#1}
|
||||
\LogosScales(\thelogoCounter)={#2}
|
||||
\LogosOpacities(\thelogoCounter)={#3}
|
||||
\LogosExtensions(\thelogoCounter)={#4}
|
||||
}
|
||||
|
||||
\DeclareRobustCommand{\SetupTitlePageLogos}{
|
||||
\titlePageLogosArray
|
||||
% Command to get opacity of a logo
|
||||
\DeclareRobustCommand{\GetLogoOpacity}[1]{
|
||||
\expand{\LogosOpacities(#1)}
|
||||
}
|
||||
|
||||
\DeclareRobustCommand{\SetupFooterLogos}{
|
||||
\footerLogosArray
|
||||
}
|
||||
% =============================================================================
|
||||
\def\skylinePath{TeX/Assets/Images/Skyline.svg}
|
||||
|
||||
@ -184,12 +172,42 @@
|
||||
\AtBeginPage{
|
||||
\setlength{\imageHeight}{2cm*\real{\mainLogoScale}*\real{\logosScale}*\real{0.45}}
|
||||
\begin{tikzpicture}[overlay, remember picture]
|
||||
% === Main Logo(s) ===
|
||||
\node[anchor=south east, inner sep=0pt, xshift=-\footerXShift, yshift=\footerYShift] (logo0) at (current page.south east) {
|
||||
\strcompare{\thepage}{1}{}{
|
||||
\includesvg[height=\imageHeight]{\imagesPath/DUMMY_FOOT.svg}
|
||||
}
|
||||
};
|
||||
\SetupFooterLogos
|
||||
% For loop to place all logos
|
||||
\foreach \i in {1,...,\value{logoCounter}} {
|
||||
% Calculate name for i-1
|
||||
\pgfmathtruncatemacro{\prev}{\i-1}
|
||||
\node[anchor=east, inner sep=0pt, xshift=-0.1cm, opacity=0.3] (logo\i) at (logo\prev.west) {
|
||||
\makeatletter
|
||||
\testarray{LogosScales}(\i)
|
||||
\setlength{\imageHeight}{1.5cm*\real{\temp@macro}*\real{\logosScale}*\real{0.55}}
|
||||
\testarray{LogosExtensions}(\i)
|
||||
\let\extension\temp@macro
|
||||
\testarray{LogosOpacities}(\i)
|
||||
\let\opacity\temp@macro
|
||||
\testarray{LogosPaths}(\i)
|
||||
\ifthenelse{\equal{\extension}{svg}}{
|
||||
\begin{tikzpicture}
|
||||
\node[opacity=\opacity] {
|
||||
\includesvg[height=\imageHeight]{TeX/Assets/Images/\temp@macro.\extension}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
}{
|
||||
\begin{tikzpicture}
|
||||
\node[opacity=\opacity] {
|
||||
\includegraphics[height=\imageHeight]{TeX/Assets/Images/\temp@macro.\extension}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
}
|
||||
\makeatother
|
||||
};
|
||||
}
|
||||
% Skyline
|
||||
\node[anchor=south west, inner sep=0pt, yshift=0em] at (current page.south west) {
|
||||
\includesvg[width=1.5\paperwidth]{\skylinePath}
|
||||
};
|
||||
|
||||
@ -9,7 +9,34 @@
|
||||
\node[anchor=north west, inner sep=0pt, xshift=1.8cm, yshift=-1.5cm, opacity=0] (logo0) at (current page.north west) {
|
||||
\includesvg[height=\imageHeight]{\imagesPath/DUMMY_FOOT.svg}
|
||||
};
|
||||
\SetupTitlePageLogos
|
||||
\foreach \i in {1,...,\value{logoCounter}} {
|
||||
% Calculate name for i-1
|
||||
\pgfmathtruncatemacro{\prev}{\i-1}
|
||||
\node[anchor=west, inner sep=0pt, xshift=-0.1cm, opacity=0.3] (logo\i) at (logo\prev.east) {
|
||||
\makeatletter
|
||||
\testarray{LogosScales}(\i)
|
||||
\setlength{\imageHeight}{1.5cm*\real{\temp@macro}*\real{\logosScale}}
|
||||
\testarray{LogosExtensions}(\i)
|
||||
\let\extension\temp@macro
|
||||
\testarray{LogosOpacities}(\i)
|
||||
\let\opacity\temp@macro
|
||||
\testarray{LogosPaths}(\i)
|
||||
\ifthenelse{\equal{\extension}{svg}}{
|
||||
\begin{tikzpicture}
|
||||
\node[opacity=\opacity] {
|
||||
\includesvg[height=\imageHeight]{TeX/Assets/Images/\temp@macro.\extension}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
}{
|
||||
\begin{tikzpicture}
|
||||
\node[opacity=\opacity] {
|
||||
\includegraphics[height=\imageHeight]{TeX/Assets/Images/\temp@macro.\extension}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
}
|
||||
\makeatother
|
||||
};
|
||||
}
|
||||
\end{tikzpicture}
|
||||
|
||||
\vskip 10em
|
||||
|
||||
@ -153,12 +153,15 @@
|
||||
% Pie Chart
|
||||
\usepackage{pgf-pie}
|
||||
|
||||
% Transparent images
|
||||
\usepackage{transparent}
|
||||
|
||||
% ==== /Imports ====
|
||||
|
||||
% Tool to import relative to current file using
|
||||
% the currfile package
|
||||
\DeclareRobustCommand{\inputrelative}[1]{
|
||||
% Write \currfiledir#1 to the log file
|
||||
\typeout{Importing file: <\currfiledir>}
|
||||
\typeout{Importing file: <\currfiledir#1> relative to <\currfiledir>}
|
||||
\input{\currfiledir#1}
|
||||
}
|
||||
@ -7,5 +7,5 @@
|
||||
|
||||
\title{Handout zur außerordentlichen STUPA-Sitzung am \meetingDate}
|
||||
|
||||
\AddLogo{TeX/Assets/Images/STUPA.png}{1.1}{0.3}{1}{0}
|
||||
\AddLogo{TeX/Assets/Images/HSRT.png}{1.4}{0.0}{2}{1}
|
||||
\AddLogoExplicit{TeX/Assets/Images/STUPA.png}{1.1}{0.3}{1}{0}
|
||||
\AddLogoExplicit{TeX/Assets/Images/HSRT.png}{1.4}{0.0}{2}{1}
|
||||
@ -3,10 +3,10 @@
|
||||
%%%% ORDER IS CRITICAL %%%%
|
||||
|
||||
% STUPA Logo
|
||||
%\AddLogo{TeX/Assets/Images/STUPA.png}{1.1}{0.3}{1}{0}
|
||||
\AddLogo{STUPA}{1.1}{0.7}{png}
|
||||
|
||||
% HSRT Logo
|
||||
\AddLogo{TeX/Assets/Images/HSRT.png}{1.4}{0.0}{1}{0}
|
||||
\AddLogo{HSRT}{1.4}{1.0}{png}
|
||||
|
||||
% METI Logo
|
||||
% \AddLogo{TeX/Assets/Images/METI.png}{1.1}{0.3}{3}{2}
|
||||
\AddLogo{METI}{1.1}{0.5}{png}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user