Created
February 23, 2025 14:45
-
-
Save programminghoch10/5a3be64d3961a40c15f8d6734a3b4773 to your computer and use it in GitHub Desktop.
LATeX Minted Cleverref Line Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% insert these two lines after your \usepackage{cleveref} | |
% then use \mintedlinelabel{labelname} inside the minted file using the "escapeinside" minted option | |
% then \cref and deriviates should correctly reference as "line x" | |
\newcounter{line} | |
\newcommand{\mintedlinelabel}[1]{\setcounter{line}{\value{FancyVerbLine}}\addtocounter{line}{-1}\refstepcounter{line}\label{#1}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment