Skip to content

Commit

Permalink
Merge pull request #759 from datalad-handbook/enh-pdf
Browse files Browse the repository at this point in the history
Numbered boxes and references
  • Loading branch information
adswa authored Sep 11, 2021
2 parents 520059f + 467516f commit d98c664
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
15 changes: 12 additions & 3 deletions dataladhandbook_support/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
18 changes: 14 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -390,35 +393,42 @@
\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},
coltitle=dataladgray,
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},
coltitle=dataladgray,
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},
coltitle=dataladgray,
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},
Expand Down

0 comments on commit d98c664

Please sign in to comment.