3

I've been trying to make the line numbers appear outside the colored frame in my output code blocks, but I also want everything (numbers included) to be inside the margins specified by the geometry package, which text paragraphs obey. My minted setup looks like this:

\documentclass[12pt]{article}

\usepackage{geometry}
\geometry{a4paper,
twoside,
left=30mm,
right=25mm,
top=25mm,
bottom=25mm}

\usepackage[section]{minted} % For code blocks
\newenvironment{code}{\captionsetup{type=listing}}{}

% ...

\begin{document}

\begin{code}
    \inputminted[
    xleftmargin=2em,
    %framexleftmargin=1.5em,
    bgcolor=lightgray!10,
    autogobble=true,
    numbers=left,
    frame=single,
    framesep=2mm,
    baselinestretch=1.2,
    fontsize=\footnotesize,
    breaklines=true]{verilog}{../UVMF_TFM/TFM_src/uvmf_tutorials/generator_tutorial_stepbystep/uvmf_template_output/project_benches/alu/rtl/verilog/alu.v}%
    \caption{Fuentes en \textit{Verilog} de una ALU}\label{dut_alu_rtl}%
\end{code}

A sample paragraph to check alignment: The simulation bench is composed of top level elements that are not generally intended to be reusable horizontally nor vertically. It defines test level parameters, the top level modules, top level sequence and top level UVM test. It also includes derived sequences and tests used to implement additional test scenarios\ldots%

% ...
% ...

\end{document}

The resulting output is like this:

Current output

But I would like it to be like this other one (but with the line numbers inside margin!):

Desired output with wrong alignment on numbers

I have tried with the framexleftmargin you can see commented out in the declared minted environment options, but this option belonged to another environment so of course it didn't compile. The second image does not have any xleftmargin or anything used, just default alignment (aside from numbers, coloring...)

Assuming it's possible, how could I get it right? Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.