From d8c18fa6728414412dc79c8c30d99a6b98bbb99f Mon Sep 17 00:00:00 2001 From: Frederik Beimgraben Date: Wed, 13 Nov 2024 11:21:20 +0000 Subject: [PATCH] Change Boxes to use picture instead of pgf --- Content/01_content.tex | 32 ++++++------------ TeX/Imports.tex | 3 ++ TeX/Report.tex | 2 +- TeX/Tools/InfoBlocks.tex | 72 +++++++++++++++++----------------------- 4 files changed, 44 insertions(+), 65 deletions(-) diff --git a/Content/01_content.tex b/Content/01_content.tex index 78e6167..1a8229d 100644 --- a/Content/01_content.tex +++ b/Content/01_content.tex @@ -1,25 +1,13 @@ -\lipsum[1] - \begin{InfoBox} - \textbf{Hinweis:} \lipsum[1] + \textbf{Hinweis:} Test % Nested InfoBox - \begin{InfoBox} - \textbf{Hinweis:} \lipsum[1] - \end{InfoBox} + \begin{multicols}{2} + \begin{InfoBox} + \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} \ No newline at end of file diff --git a/TeX/Imports.tex b/TeX/Imports.tex index 57abc31..03855b4 100644 --- a/TeX/Imports.tex +++ b/TeX/Imports.tex @@ -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 diff --git a/TeX/Report.tex b/TeX/Report.tex index e60013d..424c02e 100644 --- a/TeX/Report.tex +++ b/TeX/Report.tex @@ -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} diff --git a/TeX/Tools/InfoBlocks.tex b/TeX/Tools/InfoBlocks.tex index 27b6bd6..0ae6cb0 100644 --- a/TeX/Tools/InfoBlocks.tex +++ b/TeX/Tools/InfoBlocks.tex @@ -43,52 +43,40 @@ \FPeval{\iconOpacity}{\backgroundOpacity + 20} %% === Content === - \filbreak + \ifnum\value{coloredBoxLevel}=1 + % Commands to only execute at the page level + \filbreak + \fi + \vspace*{0.5\baselineskip} - \noindent \begin{minipage}{\linewidth} - \begin{mdframed}[ - backgroundcolor={\coloredBoxBackground!\backgroundOpacity}, - hidealllines=true, - skipabove=0.7\baselineskip, - skipbelow=0.7\baselineskip, - splitbottomskip=2pt, - 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 - \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) { - \BODY - }; - \end{tikzpicture} - \end{mdframed} + \begin{mdframed}[ + backgroundcolor={\coloredBoxBackground!\backgroundOpacity}, + hidealllines=true, + skipabove=0.7\baselineskip, + skipbelow=0.7\baselineskip, + splitbottomskip=2pt, + splittopskip=4pt, + roundcorner=5pt + ] + % [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 + \color{\coloredBoxColor!\iconOpacity} \coloredBoxIcon + } + \end{picture} + \hspace*{0.25cm} + \begin{minipage}{\linewidth-0.5cm} + \vspace*{0.5\baselineskip} + \BODY + \vspace*{0.5\baselineskip} + \end{minipage} + \end{mdframed} \end{minipage} + \vspace*{0.5\baselineskip} %% === /Content === % Reduce the nesting level counter