summaryrefslogtreecommitdiff
path: root/latexHeaders/code.sty
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-02-26 20:12:43 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-02-26 20:12:43 +0100
commitaf9fa4d69fd543fa3afcd851962b7fee22cb48e4 (patch)
tree21ac0e342c4854ac2608db03e5d4f1b8bea0bebd /latexHeaders/code.sty
parent3abc0192a619c41c3a849fdd94b2c700b884bcb4 (diff)
add srclinks
Diffstat (limited to 'latexHeaders/code.sty')
-rw-r--r--latexHeaders/code.sty17
1 files changed, 17 insertions, 0 deletions
diff --git a/latexHeaders/code.sty b/latexHeaders/code.sty
index a889596..987f43d 100644
--- a/latexHeaders/code.sty
+++ b/latexHeaders/code.sty
@@ -1,3 +1,6 @@
+\usepackage{ocgx2}
+\usepackage{fontawesome}
+
% Colors, used for syntax highlighting.
% To print this document, set all colors to black!
\usepackage{xcolor}
@@ -101,6 +104,20 @@
% \addtocounter{lstnumber}{-1}%
%}
+\ifthenelse{\isundefined{\srclink}}{}{
+ \lst@AddToHook{Init}{%
+ \ifthenelse{\equal{\lst@name}{}}{}{%
+ \begin{minipage}[t][0pt]{\linewidth}%
+ \vspace{0pt}%
+ \hfill%
+ \begin{ocg}[printocg=never]{Source links}{srclinks}{1}%
+ \hfill\href{\srclink{\lst@name}}{\faExternalLink}%
+ \end{ocg}%
+ \end{minipage}%
+ }%
+ }
+}
+
\newenvironment{btHighlight}[1][]
{\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
{\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup}