diff --git a/README.md b/README.md index a2a5419..461be3e 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,12 @@ If you have issues with `fontawesome5` (I did), try the following: Download this folder and shove the following file in the same folder as your working document. `bmc.cls`, `bmc-color.sty`, `bmc-fonts.sty`, `bmc-maths.sty`, `bmc-sectioning.sty`, `infoBulle.sty`, `marginInfoBulle.sty`, `yMainColor.sty`, `yMarginDesign` + +## Requirements + +* Pygmentize `apt install python3-pygments` +* Lualatex + +## Usage + +`lualatex --shell-escape main.tex` diff --git a/bmc.cls b/bmc.cls index 235c0b6..ada4763 100644 --- a/bmc.cls +++ b/bmc.cls @@ -599,7 +599,7 @@ hyperindex]{hyperref} % Code blocks \ifbool{bmc@code}{ - \RequirePackage{minted} + \RequirePackage[cache=false]{minted} % Per https://github.com/gpoore/minted/issues/81#issuecomment-126668144 recommendation \RequirePackage[many]{tcolorbox} \setminted{ diff --git a/infoBulle.sty b/infoBulle.sty index da2738e..378540d 100644 --- a/infoBulle.sty +++ b/infoBulle.sty @@ -1,4 +1,5 @@ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % @@ -8,7 +9,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Copyright Yves Zumbach 2017 +% Copyright Harvey Sheppard 2021 %------------------------------------------------------------------------------- % This work is distributed under the LPPL @@ -23,11 +24,9 @@ % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. -% +% % The Current Maintainer of this work is Yves Zumbach -% This work has been modified by tecosaur (https://github.com/tecosaur) for use with the file bmc.cls - \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{infoBulle}[2017/02/17 The infoBulle package typeset flat informational boxes, by Yves ZUMBACH] @@ -38,17 +37,17 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{pgfopts} -% \RequirePackage{fontspec} +\RequirePackage{fontspec} \RequirePackage{calc} -\RequirePackage[dvipsnames,svgnames,table,hyperref]{xcolor} -% \RequirePackage{translations} +\RequirePackage[usenames,dvipsnames,svgnames]{xcolor} +\RequirePackage{translations} \RequirePackage{mdframed} \RequirePackage{listings} \RequirePackage{xparse} +\RequirePackage{ragged2e} +\RequirePackage{pgfkeys} \RequirePackage{tikz} \usetikzlibrary{calc} -\RequirePackage{interfaces-base} -\LoadInterface{pgfkeys} \RequirePackage{yMainColor} @@ -63,8 +62,7 @@ \newif\ifinfoBulleMath \pgfkeys{ /infoBulle/.cd, - mathInfoBulle/.true = {\infoBulleMathtrue}, - mathInfoBulle/.false = {\infoBulleMathfalse}, + mathInfoBulle/.is if=infoBulleMath, mathInfoBulle = true, } @@ -81,8 +79,7 @@ \newif\ifinfoBulleMarginIcons \pgfkeys{ /infoBulle/.cd, - marginIcons/.true = {\infoBulleMarginIconstrue}, - marginIcons/.false = {\infoBulleMarginIconsfalse}, + marginIcons/.is if=infoBulleMarginIcons, marginIcons = false, } @@ -90,8 +87,7 @@ %------------------------------------------------------------------------------- \pgfkeys{ /infoBulle/icon/.cd, - radius/.store as dimen, - radius = 3.5mm, + radius/.initial=3.5mm, } % Icon Shape @@ -99,11 +95,22 @@ \pgfkeys{ /infoBulle/icon/.cd, shape/.is choice, - shape/round/.style = {/infoBulle/icon/radius = 3.5mm, /infoBulle/icon/shapeCommand/.code n args = {3}{\fill[##3] (##1) circle (##2);}}, - shape/hexagon/.style = {/infoBulle/icon/radius = 4mm, /infoBulle/icon/shapeCommand/.code n args = {3}{\infoBulle@hexagon{##1}{##2}[##3, rotate=90];}}, + shape/round/.style = { + /infoBulle/icon/radius = 3.5mm, + /infoBulle/icon/shapeCommand/.code n args = {3}{\fill[##3] (##1) circle (##2);}}, + shape/hexagon/.style = { + /infoBulle/icon/radius = 4mm, + /infoBulle/icon/shapeCommand/.code n args = {3}{\infoBulle@hexagon{##1}{##2}[##3, rotate=90];}}, shape/round, } +% Text Alignment +%------------------------------------------------------------------------------- +\pgfkeys{ + /infoBulle/.cd, + text alignment/.code = {\RaggedRight} +} + \ProcessPgfPackageOptions{/infoBulle} @@ -112,10 +119,10 @@ % Font Configuration %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \setfontfamily{\FA}{Font Awesome 5 Free Regular} -% \setfontfamily{\FASolid}{Font Awesome 5 Free Solid} +\setfontfamily{\FA}{Font Awesome 5 Free Regular} +\setfontfamily{\FASolid}{Font Awesome 5 Free Solid} + -\usepackage{fontawesome5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Colors @@ -126,8 +133,7 @@ \definecolor{informationColor}{RGB}{139, 195, 74} \definecolor{checkColor}{RGB}{3, 169, 244} \definecolor{warningColor}{RGB}{255, 165, 0} -\definecolor{tipColor}{RGB}{142, 68, 173} -\definecolor{exampleColor}{RGB}{156, 39, 176} +\definecolor{tipsColor}{RGB}{142, 68, 173} \definecolor{mathematicalColor}{RGB}{230, 126, 34} \colorlet{codeColor}{Grey} @@ -148,9 +154,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % infoBulle basic configuration -\colorlet{infoBulleBackground}{lightGrey} -\colorlet{infoBulleText}{black} - \mdfdefinestyle{infoBulle} { skipabove=\baselineskip, @@ -165,13 +168,9 @@ topline=false, bottomline=false, linewidth=1mm, - backgroundcolor=infoBulleBackground, - fontcolor=infoBulleText, - frametitlefontcolor=infoBulleText, + backgroundcolor=lightGrey, frametitlebelowskip=0mm, frametitleaboveskip=4mm, - splittopskip=2\topsep, - needspace=6em } \newmdenv[ style=infoBulle, @@ -190,7 +189,6 @@ \setlength{\yIconHorizontalOffset}{.73cm} % General Command \DeclareDocumentCommand{\@titleContent}{m m m}{% - \fontfamily{\headingsFont}\selectfont \ifinfoBulleMarginIcons \llap{#2\hspace*{\yIconHorizontalOffset}}% \mbox{}% @@ -198,7 +196,7 @@ \else \@afterindentfalse\@afterheading% \mbox{}% - \parbox[t][2\pgfkeysvalueof{/infoBulle/icon/radius}]{.75cm}{% + \parbox[t]{.75cm}{% \@afterindentfalse\@afterheading% \mbox{}% #2% @@ -220,11 +218,6 @@ \@titleContentTwoPart{mathematicalColor}{\mathematicalIcon}{#1 \arabic{\infoBulle@mathCounterReset}.#2}{#3}% } -% Command for example title -\DeclareDocumentCommand{\@titleContentExample}{m m m}{% - \@titleContentTwoPart{exampleColor}{\exampleIcon}{#1 \arabic{\infoBulle@mathCounterReset}.#2}{#3}% -} - % infoBulle skeleton % The little mess with lengths allow to keep the same parindent and parskip inside the infoBulle (this is a little bug from mdframed) \newlength{\tempparindent} @@ -235,8 +228,9 @@ \begin{infoBulle}[linecolor=#1, frametitle=\@titleContent{#1}{#2}{#3}]% \setlength{\parindent}{\tempparindent}% \setlength{\parskip}{\tempparskip}% - }{% -\end{infoBulle}% + \pgfkeys{/infoBulle/text alignment}% +}{% + \end{infoBulle}% } \DeclareDocumentCommand{\@infoBulleSkeleton}{m m m +m}{ \begin{@infoBulleSkeletonEnv}{#1}{#2}{#3} @@ -254,7 +248,7 @@ % infoInfo %------------------------------------------------------------------------------- \newcommand{\infoIcon}{% - \infoBulleAbstractIcon{informationColor}{\faInfo} + \infoBulleAbstractIcon{informationColor}{\FASolid\symbol{"F129}} } \DeclareDocumentCommand{\infoInfo}{m +m}{\@infoBulleSkeleton{informationColor}{\infoIcon}{#1}{#2}} \NewDocumentEnvironment{InfoInfo}{m} @@ -265,7 +259,7 @@ % warningInfoexclamation %------------------------------------------------------------------------------- \newcommand{\warningIcon}{% - \infoBulleAbstractIcon{warningColor}{\faExclamation} + \infoBulleAbstractIcon{warningColor}{\FASolid\symbol{"F12A}} } \DeclareDocumentCommand{\warningInfo}{m +m}{\@infoBulleSkeleton{warningColor}{\warningIcon}{#1}{#2}} \NewDocumentEnvironment{WarningInfo}{m} @@ -276,7 +270,7 @@ % criticalInfo %------------------------------------------------------------------------------- \newcommand{\criticalIcon}{% - \infoBulleAbstractIcon{criticalColor}{\faTimes} + \infoBulleAbstractIcon{criticalColor}{\FASolid\symbol{"F00D}} } \DeclareDocumentCommand{\criticalInfo}{m +m}{\@infoBulleSkeleton{criticalColor}{\criticalIcon}{#1}{#2}} \NewDocumentEnvironment{CriticalInfo}{m} @@ -287,7 +281,7 @@ % checkInfo %------------------------------------------------------------------------------- \newcommand{\checkIcon}{% - \infoBulleAbstractIcon{checkColor}{\faCheck} + \infoBulleAbstractIcon{checkColor}{\FASolid\symbol{"F00C}} } \DeclareDocumentCommand{\checkInfo}{m +m}{\@infoBulleSkeleton{checkColor}{\checkIcon}{#1}{#2}} \NewDocumentEnvironment{CheckInfo}{m} @@ -298,7 +292,7 @@ % questionInfo %------------------------------------------------------------------------------- \newcommand{\questionIcon}{% - \infoBulleAbstractIcon{questionColor}{\faQuestion} + \infoBulleAbstractIcon{questionColor}{\FASolid\symbol{"F128}} } \DeclareDocumentCommand{\questionInfo}{m +m}{\@infoBulleSkeleton{questionColor}{\questionIcon}{#1}{#2}} \NewDocumentEnvironment{QuestionInfo}{m} @@ -306,20 +300,20 @@ {\end{@infoBulleSkeletonEnv}} -% tipInfo +% tipsInfo %------------------------------------------------------------------------------- -\newcommand{\tipIcon}{% - \infoBulleAbstractIcon{tipColor}{\faLightbulb} +\newcommand{\tipsIcon}{% + \infoBulleAbstractIcon{tipsColor}{\FA\symbol{"F0EB}} } -\DeclareDocumentCommand{\tipInfo}{m +m}{\@infoBulleSkeleton{tipColor}{\tipIcon}{#1}{#2}} -\NewDocumentEnvironment{TipInfo}{m} -{\begin{@infoBulleSkeletonEnv}{tipColor}{\tipIcon}{#1}} +\DeclareDocumentCommand{\tipsInfo}{m +m}{\@infoBulleSkeleton{tipsColor}{\tipsIcon}{#1}{#2}} +\NewDocumentEnvironment{TipsInfo}{m} +{\begin{@infoBulleSkeletonEnv}{tipsColor}{\tipsIcon}{#1}} {\end{@infoBulleSkeletonEnv}} % codeInfo %------------------------------------------------------------------------------- \newcommand{\codeIcon}{% - \infoBulleAbstractIcon{Grey}{\faCode} + \infoBulleAbstractIcon{Grey}{\FASolid\symbol{"F121}} } \lstnewenvironment{CodeInfoLst}[1][Python] { @@ -338,7 +332,7 @@ commentstyle=\color{LimeGreen}, keywordstyle=\color{BurntOrange}\bfseries, stringstyle=\color{WildStrawberry}, - % keywords={var, func, extends}, + keywords={var, func, extends}, frame=leftline, framesep=0mm, xleftmargin=0mm,% marge ajouté à gauche du tableau (à configurer en dernier pour l'alignement global du tableau) @@ -360,23 +354,7 @@ \end{@infoBulleSkeletonEnv} } -% exampleInfo -%------------------------------------------------------------------------------- -\newcommand{\exampleIcon}{% - \infoBulleAbstractIcon{exampleColor}{\faClipboard} -} -\newcounter{example}[\infoBulle@mathCounterReset] -\NewDocumentEnvironment{example}{o}{% - \stepcounter{example}% - \begin{mdframed}[% - style=infoBulle, - linecolor=exampleColor, - frametitle=\@titleContentExample{Example}{\theexample}{#1} - ]\relax% -}{% - \end{mdframed}% -} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % User Math Commands @@ -391,35 +369,18 @@ \infoBulleAbstractIcon{mathematicalColor}{\fontsize{.6cm}{.72cm}\selectfont$\pi$}% } -% Proof commands -%------------------------------------------------------------------------------- -% \NewTranslation{english}{proposition}{Proof} -% \NewTranslation{french}{proposition}{Proof} -% \NewTranslation{german}{proposition}{Vorschlag} -\newcounter{proof}[\infoBulle@mathCounterReset] -\NewDocumentEnvironment{proof}{o}{% - \stepcounter{proof}% - \begin{mdframed}[% - style=infoBulle, - linecolor=mathematicalColor, - frametitle=\@titleContentMath{proof}{\theproof}{#1} - ]\relax% -}{% - \end{mdframed}% -} - % Theorem commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{theorem}{Theorem} -% \NewTranslation{french}{theorem}{Théorème} -% \NewTranslation{german}{theorem}{Lehrsatz} +\NewTranslation{english}{theorem}{Theorem} +\NewTranslation{french}{theorem}{Théorème} +\NewTranslation{german}{theorem}{Lehrsatz} \newcounter{theorem}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{theorem}{o}{% \stepcounter{theorem}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{theorem}{\thetheorem}{#1} + frametitle=\@titleContentMath{\GetTranslation{theorem}}{\thetheorem}{#1} ]\relax% }{% \end{mdframed}% @@ -427,16 +388,16 @@ % Lemma commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{lemma}{Lemma} -% \NewTranslation{french}{lemma}{Lemme} -% \NewTranslation{german}{lemma}{Lemma} +\NewTranslation{english}{lemma}{Lemma} +\NewTranslation{french}{lemma}{Lemme} +\NewTranslation{german}{lemma}{Lemma} \newcounter{lemma}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{lemma}{o}{% \stepcounter{lemma}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{lemma}{\thelemma}{#1} + frametitle=\@titleContentMath{\GetTranslation{lemma}}{\thelemma}{#1} ]\relax% }{% \end{mdframed}% @@ -444,16 +405,16 @@ % Corollary commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{corollary}{Corollary} -% \NewTranslation{french}{corollary}{Corollaire} -% \NewTranslation{german}{corollary}{Folge} +\NewTranslation{english}{corollary}{Corollary} +\NewTranslation{french}{corollary}{Corollaire} +\NewTranslation{german}{corollary}{Folge} \newcounter{corollary}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{corollary}{o}{% \stepcounter{corollary}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{corollary}{\thecorollary}{#1} + frametitle=\@titleContentMath{\GetTranslation{corollary}}{\thecorollary}{#1} ]\relax% }{% \end{mdframed}% @@ -461,16 +422,16 @@ % Definition commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{definition}{Definition} -% \NewTranslation{french}{definition}{Définition} -% \NewTranslation{german}{definition}{Definition} +\NewTranslation{english}{definition}{Definition} +\NewTranslation{french}{definition}{Définition} +\NewTranslation{german}{definition}{Definition} \newcounter{definition}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{definition}{o}{% \stepcounter{definition}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{definition}{\thedefinition}{#1} + frametitle=\@titleContentMath{\GetTranslation{definition}}{\thedefinition}{#1} ]\relax% }{% \end{mdframed}% @@ -478,16 +439,16 @@ % Axiom commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{axiom}{Axiom} -% \NewTranslation{french}{axiom}{Axiome} -% \NewTranslation{german}{axiom}{Axiom} +\NewTranslation{english}{axiom}{Axiom} +\NewTranslation{french}{axiom}{Axiome} +\NewTranslation{german}{axiom}{Axiom} \newcounter{axiom}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{axiom}{o}{% \stepcounter{axiom}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{axiom}{\theaxiom}{#1} + frametitle=\@titleContentMath{\GetTranslation{axiom}}{\theaxiom}{#1} ]\relax% }{% \end{mdframed}% @@ -495,16 +456,16 @@ % Proposition commands %------------------------------------------------------------------------------- -% \NewTranslation{english}{proposition}{Proposition} -% \NewTranslation{french}{proposition}{Proposition} -% \NewTranslation{german}{proposition}{Vorschlag} +\NewTranslation{english}{proposition}{Proposition} +\NewTranslation{french}{proposition}{Proposition} +\NewTranslation{german}{proposition}{Vorschlag} \newcounter{proposition}[\infoBulle@mathCounterReset] \NewDocumentEnvironment{proposition}{o}{% \stepcounter{proposition}% \begin{mdframed}[% style=infoBulle, linecolor=mathematicalColor, - frametitle=\@titleContentMath{proposition}{\theproposition}{#1} + frametitle=\@titleContentMath{\GetTranslation{proposition}}{\theproposition}{#1} ]\relax% }{% \end{mdframed}% @@ -538,3 +499,4 @@ \endinput + diff --git a/marginInfoBulle.sty b/marginInfoBulle.sty old mode 100755 new mode 100644 index 11ec193..a620217 --- a/marginInfoBulle.sty +++ b/marginInfoBulle.sty @@ -9,7 +9,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Copyright Yves Zumbach 2017 +% Copyright Harvey Sheppard 2021 %------------------------------------------------------------------------------- % This work is distributed under the LPPL @@ -24,11 +24,9 @@ % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. -% +% % The Current Maintainer of this work is Yves Zumbach -% This work has been modified by tecosaur (https://github.com/tecosaur) for use with the file bmc.cls - \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{marginInfoBulle}[2017/02/18 An add-on for the infoBulle package that defines commands for infoBulles in the margin of a document] @@ -41,13 +39,14 @@ \RequirePackage{infoBulle} \RequirePackage{yMarginDesign} +\RequirePackage{translations} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % marginInfoBulle Style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\colorlet{marginInfoBulleBackground}{white} -\colorlet{marginInfoBulleText}{black} + \mdfdefinestyle{marginInfoBulle} { skipabove=0mm, @@ -64,9 +63,6 @@ linewidth=1mm, frametitlebelowskip=1mm, frametitleaboveskip=1mm, - backgroundcolor=marginInfoBulleBackground, - fontcolor=marginInfoBulleText, - frametitlefontcolor=marginInfoBulleText } @@ -87,7 +83,7 @@ \parbox{\linewidth}{% \mbox{}% \parbox[t]{.5cm}{\leavevmode\color{#3}#2}% - \parbox[t]{\linewidth-.5cm}{\fontfamily{\headingsFont}\selectfont\bfseries\IfNoValueTF{#5}{#4}{#5}}% + \parbox[t]{\linewidth-.5cm}{\bfseries\IfNoValueTF{#5}{#4}{#5}}% }% }]% #6% @@ -103,50 +99,68 @@ % marginCritical %------------------------------------------------------------------------------- +\NewTranslation{english}{difficulty}{Difficulty} +\NewTranslation{french}{difficulty}{Difficulté} +\NewTranslation{german}{difficulty}{Schwierigkeit} \DeclareDocumentCommand{\marginCritical}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faTimes}{criticalColor}{\GetTranslation{difficulty}}{#2}{#3}} - {\marginInfoAbstract{\faTimes}{criticalColor}{\GetTranslation{difficulty}}{#2}{#3}}% + {\marginInfoAbstract*{\FASolid\symbol{"F00D}}{criticalColor}{\GetTranslation{difficulty}}{#2}{#3}} + {\marginInfoAbstract{\FASolid\symbol{"F00D}}{criticalColor}{\GetTranslation{difficulty}}{#2}{#3}}% } % marginInfo %------------------------------------------------------------------------------- +\NewTranslation{english}{info}{Information} +\NewTranslation{french}{info}{Info} +\NewTranslation{german}{info}{Info} \DeclareDocumentCommand{\marginInfo}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faInfo}{informationColor}{\GetTranslation{info}}{#2}{#3}} - {\marginInfoAbstract{\faInfo}{informationColor}{\GetTranslation{info}}{#2}{#3}}% + {\marginInfoAbstract*{\FASolid\symbol{"F129}}{informationColor}{\GetTranslation{info}}{#2}{#3}} + {\marginInfoAbstract{\FASolid\symbol{"F129}}{informationColor}{\GetTranslation{info}}{#2}{#3}}% } -% marginTip +% marginTips %------------------------------------------------------------------------------- -\DeclareDocumentCommand{\marginTip}{s o m}{% +\NewTranslation{english}{tips}{Tip} +\NewTranslation{french}{tips}{Astuce} +\NewTranslation{german}{tips}{Trick} +\DeclareDocumentCommand{\marginTips}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faLightbulb}{tipColor}{\GetTranslation{tip}}{#2}{#3}} - {\marginInfoAbstract{\faLightbulb}{tipColor}{\GetTranslation{tip}}{#2}{#3}}% + {\marginInfoAbstract*{\FA\symbol{"F0EB}}{tipsColor}{\GetTranslation{tips}}{#2}{#3}} + {\marginInfoAbstract{\FA\symbol{"F0EB}}{tipsColor}{\GetTranslation{tips}}{#2}{#3}}% } % marginQuestion %------------------------------------------------------------------------------- +\NewTranslation{english}{question}{Question} +\NewTranslation{french}{question}{Question} +\NewTranslation{german}{question}{Frage} \DeclareDocumentCommand{\marginQuestion}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faQuestion}{questionColor}{\GetTranslation{question}}{#2}{#3}} - {\marginInfoAbstract{\faQuestion}{questionColor}{\GetTranslation{question}}{#2}{#3}}% + {\marginInfoAbstract*{\FASolid\symbol{"F128}}{questionColor}{\GetTranslation{question}}{#2}{#3}} + {\marginInfoAbstract{\FASolid\symbol{"F128}}{questionColor}{\GetTranslation{question}}{#2}{#3}}% } % marginCheck %------------------------------------------------------------------------------- +\NewTranslation{english}{check}{Example} +\NewTranslation{french}{check}{Exemple} +\NewTranslation{german}{check}{Beispiel} \DeclareDocumentCommand{\marginCheck}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faCheck}{checkColor}{\GetTranslation{check}}{#2}{#3}} - {\marginInfoAbstract{\faCheck}{checkColor}{\GetTranslation{check}}{#2}{#3}}% + {\marginInfoAbstract*{\FASolid\symbol{"F00C}}{checkColor}{\GetTranslation{check}}{#2}{#3}} + {\marginInfoAbstract{\FASolid\symbol{"F00C}}{checkColor}{\GetTranslation{check}}{#2}{#3}}% } % marginWarning %------------------------------------------------------------------------------- +\NewTranslation{english}{warning}{Warning} +\NewTranslation{french}{warning}{Attention} +\NewTranslation{german}{warning}{Warnung} \DeclareDocumentCommand{\marginWarning}{s o m}{% \IfBooleanTF{#1} - {\marginInfoAbstract*{\faExclamation}{warningColor}{\GetTranslation{warning}}{#2}{#3}} - {\marginInfoAbstract{\faExclamation}{warningColor}{\GetTranslation{warning}}{#2}{#3}}% + {\marginInfoAbstract*{\FASolid\symbol{"F12A}}{warningColor}{\GetTranslation{warning}}{#2}{#3}} + {\marginInfoAbstract{\FASolid\symbol{"F12A}}{warningColor}{\GetTranslation{warning}}{#2}{#3}}% } \endinput diff --git a/yMainColor.sty b/yMainColor.sty index 279bf3c..e477eef 100644 --- a/yMainColor.sty +++ b/yMainColor.sty @@ -9,7 +9,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Copyright Yves Zumbach 2017 +% Copyright Harvey Sheppard 2021 %------------------------------------------------------------------------------- % This work is distributed under the LPPL @@ -24,7 +24,7 @@ % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. -% +% % The Current Maintainer of this work is Yves Zumbach \NeedsTeXFormat{LaTeX2e} diff --git a/yMarginDesign.sty b/yMarginDesign.sty index d5b919e..91695fc 100644 --- a/yMarginDesign.sty +++ b/yMarginDesign.sty @@ -9,7 +9,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Copyright Yves Zumbach 2017 +% Copyright Harvey Sheppard 2021 %------------------------------------------------------------------------------- % This work is distributed under the LPPL @@ -24,7 +24,7 @@ % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. -% +% % The Current Maintainer of this work is Yves Zumbach @@ -33,14 +33,13 @@ % Required Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{xparse} -\RequirePackage{marginnote} +\RequirePackage{changepage} \RequirePackage{marginfix} +\RequirePackage{marginnote} +\RequirePackage{pgfkeys} \RequirePackage{ragged2e} -\RequirePackage{interfaces-base} -\LoadInterface{pgfkeys} \RequirePackage{xcolor} -\RequirePackage{changepage} +\RequirePackage{xparse} @@ -51,11 +50,29 @@ % Configuration command \DeclareDocumentCommand{\yMarginDesignConfiguration}{m}{\pgfkeys{/yMarginDesign/.cd, #1}} -% Color of the title, marginNoteMark, etc. +% Colors \pgfkeys{ /yMarginDesign/.cd, - color/.store as color, - color=black, + emph color/.initial = black, + text color/.initial = black, +} + +% Marginparskip +\pgfkeys{ + /yMarginDesign/.cd, + marginparskip/.initial = 3mm, +} + +% Size of the margin text +\pgfkeys{ +/yMarginDesign/.cd, +size/.code = \footnotesize, +} + +% Style of the margin title +\pgfkeys{% + /yMarginDesign/.cd, + titleFormat/.code = \normalsize\color{\pgfkeysvalueof{/yMarginDesign/emph color}} } % Marginpar alignment @@ -72,23 +89,28 @@ % Typeset a paragraph in the margin \DeclareDocumentCommand{\marginElement}{m}{% - \marginpar{% + \marginpar{{% \pgfkeys{/yMarginDesign/alignment}% - \footnotesize% - #1% - }\unskip% + \pgfkeys{/yMarginDesign/size}% + \color{\pgfkeysvalueof{/yMarginDesign/text color}} + #1\par\vspace{\pgfkeysvalueof{/yMarginDesign/marginparskip}}% + }}\unskip% }% % The mark for the marginNote -\DeclareDocumentCommand{\marginMark}{m}{{\color{\pgfkeysvalueof{/yMarginDesign/color}}#1.~}} +\DeclareDocumentCommand{\marginMark}{m}{{\color{\pgfkeysvalueof{/yMarginDesign/emph color}}#1.~}} -\DeclareDocumentCommand{\printMarginNoteMark}{}{% - \@ifpackageloaded{hyperref}% - {{\hypersetup{linkcolor=\pgfkeysvalueof{/yMarginDesign/color}}\footnotemark}}% - {\textcolor{\pgfkeysvalueof{/yMarginDesign/color}}{\footnotemark}} +\@ifpackageloaded{hyperref}{% + \DeclareDocumentCommand{\printMarginNoteMark}{}{ + {\hypersetup{linkcolor=\pgfkeysvalueof{/yMarginDesign/emph color}}\footnotemark}% + }% +}{ + \DeclareDocumentCommand{\printMarginNoteMark}{}{% + {\textcolor{\pgfkeysvalueof{/yMarginDesign/emph color}}{\footnotemark}}% + } } -% Typeset a paragraph in the margin with a number (as a footnote) +% Typeset a paragraph in the margin with a number (as a footnote) \DeclareDocumentCommand{\marginNote}{m}{% \printMarginNoteMark \ignorespaces% @@ -124,4 +146,4 @@ % Margin Design Elements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\DeclareDocumentCommand{\marginTitle}{m}{{\bfseries\large\color{\pgfkeysvalueof{/yMarginDesign/color}}#1}\\} +\DeclareDocumentCommand{\marginTitle}{m}{{\pgfkeys{/yMarginDesign/titleFormat}#1}\\}