15

How can I change the font size of the number in minted environment? The font can be modified with fontsize parameter, but the number on the left side is not affected with it.

enter image description here enter image description here

This is the code:

\documentclass[11pt,article,oneside]{memoir}

\usepackage{listings}
\usepackage{xcolor}
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage{minted}

\counterwithout{section}{chapter}

\begin{document}

\begin{minted}[mathescape,
               linenos,
               numbersep=5pt,
               gobble=2,
               frame=lines,
               framesep=2mm,
               fontsize=\tiny]{csharp}
  string title = "This is a Unicode π in the sky"
  /*
  Defined as $\pi=\lim_{n\to\infty}\frac{P_n}{d}$ where $P$ is the perimeter
  of an $n$-sided regular polygon circumscribing a
  circle of diameter $d$.
  */
  const double pi = 3.1415926535
\end{minted}

\end{document}

1 Answer 1

15

\theFancyVerbLine should be redefined to control the line number style.

\renewcommand{\theFancyVerbLine}{\sffamily \textcolor[rgb]{0.5,0.5,1.0}{\huge \oldstylenums{\arabic{FancyVerbLine}}}}
2
  • How does this affect line number referencing?
    – Werner
    Sep 11, 2013 at 20:25
  • 1
    @Werner fancyvrb redefines \refstepcounter for its purposes so that it essentially uses \arabic{FancyVerbLine} for defining \@currentlabel, rather than \theFancyVerbLine (see lines 1076–1080). So redefining \theFancyVerbLine is OK.
    – egreg
    Sep 11, 2013 at 21:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .