Change Boxes to use picture instead of pgf

This commit is contained in:
Frederik Beimgraben 2024-11-13 11:21:20 +00:00
parent b3261a3812
commit d8c18fa672
4 changed files with 44 additions and 65 deletions

View File

@ -1,25 +1,13 @@
\lipsum[1]
\begin{InfoBox}
\textbf{Hinweis:} \lipsum[1]
\textbf{Hinweis:} Test
% Nested InfoBox
\begin{multicols}{2}
\begin{InfoBox}
\textbf{Hinweis:} \lipsum[1]
\textbf{Hinweis:} Test
\end{InfoBox}
\columnbreak
\begin{InfoBox}
\textbf{Hinweis:} Test
\end{InfoBox}
\end{multicols}
\end{InfoBox}
\begin{WarningBox}
\textbf{Warnung:} \lipsum[1]
\end{WarningBox}
\begin{SuccessBox}
\textbf{Erfolg:} \lipsum[1]
\end{SuccessBox}
\begin{ImportantBox}
\textbf{Wichtig:} \lipsum[1]
\end{ImportantBox}
\begin{CustomBox}{\faIcon{user}}{blue}
\textbf{Info:} \lipsum[1]
\end{CustomBox}

View File

@ -147,6 +147,9 @@
% FPeval for floating point calculations
\usepackage{xfp}
% To refer to page text area
\usepackage{tikzpagenodes}
% ==== /Imports ====
% Tool to import relative to current file using

View File

@ -52,7 +52,7 @@
text={\begin{tabular}{c}%
\setcounter{it}{1}%
\whiledo{\theit<100}{%
\foreach \col in {0,...,15}{\color{black!5}\BeginAccSupp{}\waterMarkText~~\EndAccSupp{}}\\%
\foreach \col in {0,...,15}{\color{black!5}\BeginAccSupp{ActualText=}\waterMarkText~~\EndAccSupp{}}\\%
\stepcounter{it}%
}
\end{tabular}

View File

@ -43,9 +43,12 @@
\FPeval{\iconOpacity}{\backgroundOpacity + 20}
%% === Content ===
\ifnum\value{coloredBoxLevel}=1
% Commands to only execute at the page level
\filbreak
\vspace*{0.5\baselineskip}
\fi
\vspace*{0.5\baselineskip}
\noindent
\begin{minipage}{\linewidth}
\begin{mdframed}[
@ -57,38 +60,23 @@
splittopskip=4pt,
roundcorner=5pt
]
\tikzset{every picture/.style={opacity=1}}
\begin{tikzpicture}
% Icon area
\node[
% Middle Top
anchor=north,
inner sep=0pt,
outer sep=0pt,
align=center,
text width=1cm,
] at (0,0 |- current bounding box.north) {
\coloredBoxIconPrefix
% [REFACTOR] using picture environment instead of tikz due to pgf errors
\begin{picture}(\textwidth, 0)(0, 0)
\put(\coloredBoxIconOffsetX-\coloredBoxIconSize,\coloredBoxIconOffsetY-0.7cm){
\fontsize{\coloredBoxIconSize}{\coloredBoxIconSize}
\selectfont
\hspace*{\coloredBoxIconOffsetX-1.75cm}
\raisebox{\coloredBoxIconOffsetY}
{\color{\coloredBoxColor!\iconOpacity} \coloredBoxIcon}
};
% Content area
\node[
anchor=north west,
inner sep=10pt,
outer sep=0pt,
text width=\linewidth-0.7cm,
align=justify
] at (-0.5cm,0 |- current bounding box.north) {
\color{\coloredBoxColor!\iconOpacity} \coloredBoxIcon
}
\end{picture}
\hspace*{0.25cm}
\begin{minipage}{\linewidth-0.5cm}
\vspace*{0.5\baselineskip}
\BODY
};
\end{tikzpicture}
\vspace*{0.5\baselineskip}
\end{minipage}
\end{mdframed}
\end{minipage}
\vspace*{0.5\baselineskip}
%% === /Content ===
% Reduce the nesting level counter