0

how can I refer to a single line of source code using minted by React Native code (jsx). the solutions here work but don't refer to correct link label

Highlight labeled lines of code with minted

Reference source code line in minted package

I think all Lebel refer to label \label{sec:bsr}

Example :

Lorem ipsum dolor sit amet, ~\ref{useStateBeginn} consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ~\ref{dataArray} in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

\newenvironment{code}{\captionsetup{type=listing}}{}
    %\renewcommand{\cftlistingpresnum}{Listing~}
    %\setlength{\cftlistingnumwidth}{2cm}
    \renewcommand{\listingscaption}{\textbf{Code}}
    \renewcommand{\listoflistingscaption}{codeidex}

\usepackage{minted} \usepackage{caption} \usepackage{graphicx} \usepackage{hyperref} \hypersetup{ colorlinks=true, citecolor=Orange4, linkcolor=Blue1, filecolor=Firebrick1,
urlcolor=black, pdftitle={Overleaf Example}, pdfpagemode=FullScreen, }

\begin{code}
\captionof{listing}{\textbf{Component}}
\label{sec:bsr}

\begin{minted}
[
autogobble = true,
breaklines=true,
frame=lines,
framesep=2mm,
baselinestretch=1.2,
bgcolor=Cornsilk1,
fontsize=\footnotesize,
linenos=true,
escapeinside=!!
]{lexer.py:JsxLexer -x}

 // Data Array !\label{dataArray}!
Array

// useState  !\label{useStateBeginn}!
useState ...

\end{minted} \end{code}

WGH
  • 1

0 Answers0