Skip to content

Reference lines with less boilerplate #459

@zax71

Description

@zax71

I have been annotating a lot of code in a LaTeX document recently using the method outlined in this Tex Stack Exchange post. But when working with this method it is a bit cumbersome to work with - adding the reference to a list of highlighted lines manually. Could I suggest some different syntax for achieving this?

\begin{document}
\begin{minted}[
    linenos=true, 
    escapeinside=!!,
    highlightlabels,
  ]{c++}
    i = i + 1 ;  
    j = j + 1 ; !\label{myline}!
    k = k + 1 ;
    l = l + 1 ; !\label{yourline}!
\end{minted}
The important lines are line~\ref{myline} and line\ref{yourline}.

The minted package should be able to figure out what lines need highlighting purely based off the lines inside the code block - without requiring them to be defined separately.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions