[Latex] Changing the font size in code blocks #730
Replies: 3 comments 6 replies
-
This is a nice idea and it would be good to add font-size control. I am wondering though if this should be a global option that is set in cc: @AakashGfude |
Beta Was this translation helpful? Give feedback.
-
For HTML, a straightforward approach would be to add a custom CSS file (https://jupyterbook.org/en/stable/advanced/html.html?highlight=css#custom-css-or-javascript) With something like: div.highlight {
font-size: 0.8em;
} EDIT: just realized you're talking about Latex, I will update the title to clarify |
Beta Was this translation helpful? Give feedback.
-
It took me about a day of trial and error, but I got it working. Here's the part of my
Ultimately I found the solution by searching the sphinx:
config:
latex_elements:
papersize: "a4paper"
pointsize: "12pt" # Options: 10pt, 11pt, 12pt ONLY ⚠
preamble: |
\makeatletter % enable @-symbol for macros; don't forget to turn of with \makeatother
% Use 1.5x lìne spacing
\usepackage{setspace}
\onehalfspacing
% Reduce font ^size in ^code blocks
% Override the fontsize command defined and used by fancyvrb (which implements Verbatim environments).
% For size options see https://en.wikibooks.org/wiki/LaTeX/Fonts#Built-in_sizes
\renewcommand{\FV@FontSize}{\scriptsize}
\makeatother % disable @-symbol for macros It's easy once you know how to do it 🤐 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm trying to change (reduce) the font size of my code blocks.
For example with this block:
Here's what I tried so far:
fontsize: 6
,font-size: 6
, orfontSize: 6
to the directive parameters did not help.Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions