From d772a44c67f7a6b9c4326d8e5f59021aafced2d0 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Fri, 15 Sep 2023 16:19:46 +0200 Subject: [PATCH] doc: tools, dev: Add caption and box for verbatim. --- doc/dev/documentation.org | 2 ++ doc/tools/latex.org | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/dev/documentation.org b/doc/dev/documentation.org index aaf32969..f73be591 100644 --- a/doc/dev/documentation.org +++ b/doc/dev/documentation.org @@ -115,6 +115,7 @@ source code: https://orgmode.org/org.html#Working-with-Source-Code Here is an example for python source code: #+BEGIN_EXAMPLE +#+CAPTION: Get os type name in Python code #+begin_src python import os @@ -125,6 +126,7 @@ print(f"Document build on system: {os.name}") If you use GNUEmacs, it is also possible to run the code inside a block and export (or not) the reuslts in the document. +#+CAPTION: Get os type name in Python code #+begin_src python :python python3 :results output :exports both :noweb yes import os diff --git a/doc/tools/latex.org b/doc/tools/latex.org index 06263f85..32c47e23 100644 --- a/doc/tools/latex.org +++ b/doc/tools/latex.org @@ -32,3 +32,20 @@ #+LATEX_HEADER: \BeforeBeginEnvironment{minted}{\begin{tcolorbox}[boxsep=0pt, left=0.1cm, right=0.1cm, arc=0pt, boxrule=0.5pt, colback=white]}% #+LATEX_HEADER: \AfterEndEnvironment{minted}{\end{tcolorbox}}% + +#+LATEX_HEADER: \makeatletter +#+LATEX_HEADER: \AtBeginEnvironment{minted}{\dontdofcolorbox} + +#+LATEX_HEADER: \def\dontdofcolorbox{\renewcommand\fcolorbox[4][]{##4}} +#+LATEX_HEADER: \makeatother + +#+LATEX_HEADER: \BeforeBeginEnvironment{verbatim}{\begin{tcolorbox}[boxsep=0pt, left=0.1cm, right=0.1cm, arc=0pt, boxrule=0.5pt, colback=white]}% +#+LATEX_HEADER: \AfterEndEnvironment{verbatim}{\end{tcolorbox}}% + +#+LATEX_HEADER: \makeatletter +#+LATEX_HEADER: \AtBeginEnvironment{verbatim}{\dontdofcolorbox} + +#+LATEX_HEADER: \def\dontdofcolorbox{\renewcommand\fcolorbox[4][]{##4}} +#+LATEX_HEADER: \makeatother + +#+LATEX_HEADER: \verbatimfont{\footnotesize} -- GitLab