diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2025-03-21 10:13:33 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2025-03-21 10:13:33 +0100 |
commit | 0c2ada30f2180b8d0add9ba5e57869eaa3ffcf15 (patch) | |
tree | ef753bd2513f24da4431cf612ebaf8d5ece3b43e | |
parent | 17b234852e45b333ec638ecb3a38848bd4305f44 (diff) |
Automatically starts the columns for all document with a sidebar
-rwxr-xr-x | common/99_sidebar.tex | 41 | ||||
-rwxr-xr-x | model_1/resources/99_begin.tex | 6 | ||||
-rwxr-xr-x | model_2/resources/00_preamble.tex | 1 | ||||
-rwxr-xr-x | model_3/resources/99_sidebar.tex | 21 | ||||
-rwxr-xr-x | model_4/resources/00_preamble.tex | 1 | ||||
-rwxr-xr-x | model_4/resources/99_sidebar.tex | 28 | ||||
-rwxr-xr-x | model_5/resources/99_begin.tex | 6 |
7 files changed, 44 insertions, 60 deletions
diff --git a/common/99_sidebar.tex b/common/99_sidebar.tex index ab599a0..5bc96cd 100755 --- a/common/99_sidebar.tex +++ b/common/99_sidebar.tex @@ -1,5 +1,39 @@ +\usepackage{paracol} \newlength{\notesep} +% All the models uses two columns. +% At any time in the RST document, you can add elements in the sidebar using +% the sidebar directive. +% +% .. sidebar:: Informations +% +% * 17 allée des cerisiers +% * 75001 Paris |phoneicon| +% * 01 23 45 67 89 |mailicon| +% * email@example |noicon| +% +% You can close the sidebar at any time, but this requires to use latex code in the document +% +% .. raw:: latex +% +% \flushpage +% \end{paracol} +% \newgeometry{left=3cm,right=3cm,bottom=1cm,top=1cm} + + +% Switch in paracol mode from the begining of the document +% This can be disabled by defining \nocolumns before loading +% this template. +% +% \def\nocolumns{} + +\ifdefined\nocolumns +\else + \AtBeginDocument{% + \begin{paracol}{2} + } +\fi + \def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]} \let\endchangemargin=\endlist @@ -21,8 +55,9 @@ \ifdefinedcolor{textsidecolor}{\color{black}}{} } +% If the column is still active, make it go to the bottom of the page. +\makeatletter \AtEndDocument{% - % Make the column go to the bottom - \flushpage - \end{paracol} + \ifthenelse{\equal{\@currenvir}{paracol}}{\flushpage\end{paracol}}{} } +\makeatother diff --git a/model_1/resources/99_begin.tex b/model_1/resources/99_begin.tex index 7b7a793..8783087 100755 --- a/model_1/resources/99_begin.tex +++ b/model_1/resources/99_begin.tex @@ -1,7 +1 @@ \input{../common/90_ref.tex} - -% On charge les colonnes dès le début du document. -\AtBeginDocument{% - \begin{paracol}{2} -} - diff --git a/model_2/resources/00_preamble.tex b/model_2/resources/00_preamble.tex index 89cb0c4..a199f07 100755 --- a/model_2/resources/00_preamble.tex +++ b/model_2/resources/00_preamble.tex @@ -21,4 +21,5 @@ \input{../common/10_lists.tex} \input{../common/10_nowidows.tex} \input{../common/10_levels.tex} +\def\nocolumns{} \input{../common/99_sidebar.tex} diff --git a/model_3/resources/99_sidebar.tex b/model_3/resources/99_sidebar.tex index fb98c57..d8ecbfd 100755 --- a/model_3/resources/99_sidebar.tex +++ b/model_3/resources/99_sidebar.tex @@ -1,17 +1,8 @@ -\newlength{\notesep} - -\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]} -\let\endchangemargin=\endlist - - -\ifdefinedcolor{backsidecolor}{% - \backgroundcolor{c[1]}{backsidecolor} -}{} - -\setlength{\columnseprule}{0.2pt} +\def\nocolumns{} +\input{../common/99_sidebar.tex} % Une commande dédiée pour les notes de marge -\newcommand{\DUsidebar}[1]{% +\renewcommand{\DUsidebar}[1]{% \switchcolumn[1] \begin{changemargin}{0.5cm}{0.0cm} \small @@ -22,9 +13,3 @@ \switchcolumn \ifdefinedcolor{textsidecolor}{\color{black}}{} } - -\AtEndDocument{% - % Make the column go to the bottom - \flushpage - \end{paracol} -} diff --git a/model_4/resources/00_preamble.tex b/model_4/resources/00_preamble.tex index c92dc33..d6d7875 100755 --- a/model_4/resources/00_preamble.tex +++ b/model_4/resources/00_preamble.tex @@ -23,3 +23,4 @@ \input{../common/10_lists.tex} \input{../common/10_nowidows.tex} \input{../common/10_levels.tex} +\input{../common/99_sidebar.tex} diff --git a/model_4/resources/99_sidebar.tex b/model_4/resources/99_sidebar.tex index 36bc102..6f3d42f 100755 --- a/model_4/resources/99_sidebar.tex +++ b/model_4/resources/99_sidebar.tex @@ -1,30 +1,4 @@ -\newlength{\notesep} - -\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]} -\let\endchangemargin=\endlist - \ifdefinedcolor{backsidecolor}{% \backgroundcolor{c[1]}{backsidecolor} + \backgroundcolor{c[0]}{white} }{} - -% Une commande dédiée pour les notes de marge -\newcommand{\DUsidebar}[1]{% - \switchcolumn[0] - \begin{changemargin}{0.5cm}{1cm} - \AltFont\selectfont - \ifdefinedcolor{textsidecolor}{\color{textsidecolor}}{} - #1 - \end{changemargin} - \vspace{\notesep} - \switchcolumn - \ifdefinedcolor{textsidecolor}{\color{black}}{} -} - -\AtBeginDocument{% - \begin{paracol}{2} -} -\AtEndDocument{% - % Make the column go to the bottom - \flushpage - \end{paracol} -} diff --git a/model_5/resources/99_begin.tex b/model_5/resources/99_begin.tex index 7b7a793..8783087 100755 --- a/model_5/resources/99_begin.tex +++ b/model_5/resources/99_begin.tex @@ -1,7 +1 @@ \input{../common/90_ref.tex} - -% On charge les colonnes dès le début du document. -\AtBeginDocument{% - \begin{paracol}{2} -} - |