restyle RST option lists (#17637)

* WIP: restyle RST option lists

* apply similar style to Latex

* fix tests

* minor visual tweaks

* update tests

* remove leftover comments
This commit is contained in:
Andrey Makarov 2021-04-10 10:49:01 +03:00 • committed by GitHub
commit 2150cd1826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 21 deletions

View file

@ -50,7 +50,7 @@ doc.file = """
\usepackage{fancyvrb, courier}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{enumitem} % for enumList and rstfootnote
\usepackage{enumitem} % for option list, enumList, and rstfootnote
\usepackage{xcolor}
\usepackage[tikz]{mdframed}
@ -77,6 +77,15 @@ bottomline=false}
\newenvironment{rstpre}{\VerbatimEnvironment\begingroup\begin{Verbatim}[fontsize=\footnotesize , commandchars=\\\{\}]}{\end{Verbatim}\endgroup}
\newenvironment{rstfootnote}{\begin{description}[labelindent=1em,leftmargin=1em,labelwidth=2.6em]}{\end{description}}
\ifdim\linewidth<30em
\def\rstoptleftmargin{0.4\linewidth}
\def\rstoptlabelwidth{0.35\linewidth}
\else
\def\rstoptleftmargin{12em}
\def\rstoptlabelwidth{10.5em}
\fi
\newenvironment{rstoptlist}{%
\begin{description}[font=\sffamily\bfseries,style=nextline,leftmargin=\rstoptleftmargin,labelwidth=\rstoptlabelwidth]}{\end{description}}
% to pack tabularx into a new environment, special syntax is needed :-(
\newenvironment{rsttab}[1]{\tabularx{\linewidth}{#1}}{\endtabularx}