1

I have a code snippet where I use minted for nice display:

\begin{figure}[H]
    \begin{minted}[
        frame=single,
        obeytabs=true,
        tabsize=4,
        linenos,
        numbersep=6pt
    ]{json}
    {  
        "employee": {  
            "name": "test",   
            "salary": 56000,   
            "married": true  
        }  
    }  
    \end{minted}
\end{figure}

However, I can't get the line numbers to be inside the frame. This seems to be a common problem and was discussed before, but other solution suggested to use xleftmargin=\parindent, which did not help. How can I fix this problem?

1 Answer 1

3

From your post, I understood that you need to print the line numbers inside the frame, if my assumption is correct, then please try with the below mentioned MWE:

\documentclass{book}
\usepackage{minted}

\begin{document}

\begin{figure}[H]
    \begin{minted}[
        frame=single,
        obeytabs=true,
        tabsize=4,
        linenos,
        numbersep=-10pt
    ]{json}
    {  
        "employee": {  
            "name": "test",   
            "salary": 56000,   
            "married": true  
        }  
    }  
    \end{minted}
\end{figure}
\end{document}

Output

enter image description here

Please excuse me, if my understanding is wrong...

1
  • Yes, that's exactly what I meant. Thanks!
    – Kyu96
    Jan 25, 2020 at 14:49

You must log in to answer this question.

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