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} \begin{InfoBox}
\textbf{Hinweis:} \lipsum[1] \textbf{Hinweis:} Test
% Nested InfoBox % Nested InfoBox
\begin{InfoBox} \begin{multicols}{2}
\textbf{Hinweis:} \lipsum[1] \begin{InfoBox}
\end{InfoBox} \textbf{Hinweis:} Test
\end{InfoBox}
\columnbreak
\begin{InfoBox}
\textbf{Hinweis:} Test
\end{InfoBox}
\end{multicols}
\end{InfoBox} \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 % FPeval for floating point calculations
\usepackage{xfp} \usepackage{xfp}
% To refer to page text area
\usepackage{tikzpagenodes}
% ==== /Imports ==== % ==== /Imports ====
% Tool to import relative to current file using % Tool to import relative to current file using

View File

@ -52,7 +52,7 @@
text={\begin{tabular}{c}% text={\begin{tabular}{c}%
\setcounter{it}{1}% \setcounter{it}{1}%
\whiledo{\theit<100}{% \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}% \stepcounter{it}%
} }
\end{tabular} \end{tabular}

View File

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