From bcf5f19ab134ed1a59f6f250770a33a35543e2a5 Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Fri, 10 Sep 2021 18:56:28 +0200 Subject: [PATCH 1/2] Use proper latex counters for boxes Specifically find-out-more and windows-wit. This makes it now possible to do "numerical" references, and removes the need for the "on the topic of..." suffixes in the text somewhat. --- dataladhandbook_support/directives.py | 15 ++++++++++++--- docs/conf.py | 15 +++++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/dataladhandbook_support/directives.py b/dataladhandbook_support/directives.py index b917ab639..39a29340b 100644 --- a/dataladhandbook_support/directives.py +++ b/dataladhandbook_support/directives.py @@ -76,8 +76,11 @@ def _get_counted_boxstart(label, node): if flt else ', float' return \ "\\begin{{{label}}}" \ - "[before title={{\\thetcbcounter\\ }}{float_args}]" \ + "[{ref}before title={{\\thetcbcounter\\ }}{float_args}]" \ "{{{title}}}\n".format( + ref='label={{{r}}}, '.format(r=node.attributes['ids'][0]) + if len(node.attributes.get('ids', [])) + else '', label=label, title=title, float_args=float_args, @@ -237,7 +240,10 @@ def depart_findoutmoreref_html(self, node): def visit_findoutmoreref_latex(self, node): - self.body.append('{\\findoutmoreiconinline}\sphinxcrossref{Find-out-more }') + # \textit to immitate the href style + self.body.append( + '\\textit{{Find-out-more}}~{{\\findoutmoreiconinline}}\\textit{{\\ref{{{r}}}}} '.format( + r=node.children[0].attributes['refid'])) def depart_findoutmoreref_latex(self, node): @@ -258,7 +264,10 @@ def depart_windowswitref_html(self, node): def visit_windowswitref_latex(self, node): - self.body.append('{\\windowswiticoninline}\sphinxcrossref{Windows-wit }') + # \textit to immitate the href style + self.body.append( + '\\textit{{Windows-wit}}~{{\\windowswiticoninline}}\\textit{{\\ref{{{r}}}}} '.format( + r=node.children[0].attributes['refid'])) def depart_windowswitref_latex(self, node): diff --git a/docs/conf.py b/docs/conf.py index 0540f1558..997152808 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -390,8 +390,10 @@ \end{scope}}} } +\newcounter{HandbookWIN}[chapter] +\renewcommand\theHandbookWIN{W\arabic{chapter}.\arabic{HandbookWIN}} \newtcolorbox[% - auto counter, + use counter*=HandbookWIN, number within=chapter, list inside=windowswits]{windowswit}[2][]{% enhanced, ribbon win, title={#2}, @@ -399,8 +401,10 @@ colbacktitle=windowsgreen, colframe=windowsgreen!70!black, #1 } +\newcounter{HandbookGIT}[chapter] +\renewcommand\theHandbookGIT{G\arabic{chapter}.\arabic{HandbookGIT}} \newtcolorbox[% - auto counter, + use counter*=HandbookGIT, number within=chapter, list inside=gitusernotes]{gitusernote}[2][]{% enhanced, ribbon git, title={#2}, @@ -408,8 +412,10 @@ colbacktitle=dataladblue, colframe=dataladblue!70!black, #1 } +\newcounter{HandbookFOM}[chapter] +\renewcommand\theHandbookFOM{M\arabic{chapter}.\arabic{HandbookFOM}} \newtcolorbox[ - auto counter, + use counter*=HandbookFOM, number within=chapter, list inside=findoutmores]{findoutmore}[2][]{% enhanced, ribbon more, title={#2}, @@ -417,8 +423,9 @@ colbacktitle=dataladyellow, colframe=dataladyellow!70!black, #1 } +% unnumbered, they are short and placed at the exact position +% must change we there are in-text references \newtcolorbox[ - auto counter, number within=chapter, list inside=importantnotes]{importantnote}[2][]{% enhanced, ribbon important, title={#2}, From 467516f0e12f41a1b14815d26f75a4ab2bb67ca6 Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Fri, 10 Sep 2021 18:58:09 +0200 Subject: [PATCH 2/2] Address hundreds of spacing warnings --- docs/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 997152808..dda0e7905 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -350,6 +350,9 @@ % make sure all float stay in their respective chapter %\usepackage[chapter]{placeins} +% make enough room for the auto-generated header content +\setlength{\headheight}{13.6pt} + \usepackage{xcolor} \definecolor{dataladyellow}{HTML}{FFA200} \definecolor{dataladblue}{HTML}{7FD5FF}