Latex/PDF: hyperlink local references
The Latex renderer was not linking local references because Latex output was intended as a printing-to-paper alternative to HTML. For writing papers with acmart, however, local PDF hyperlinks are relevant. So, enable them.
This commit is contained in:
parent
1e81f0005a
commit
732d631951
|
@ -21,6 +21,7 @@
|
|||
(define disable-images (make-parameter #f))
|
||||
(define escape-brackets (make-parameter #f))
|
||||
(define suppress-newline-content (make-parameter #f))
|
||||
(define disable-hyperref (make-parameter #f))
|
||||
|
||||
(define-struct (toc-paragraph paragraph) ())
|
||||
|
||||
|
@ -243,12 +244,14 @@
|
|||
(printf "{")
|
||||
(show-number)
|
||||
(parameterize ([disable-images #t]
|
||||
[escape-brackets #t])
|
||||
[escape-brackets #t]
|
||||
[disable-hyperref #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
(printf "}"))
|
||||
(printf "{")
|
||||
(show-number)
|
||||
(render-content (part-title-content d) d ri)
|
||||
(parameterize ([disable-hyperref #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
(printf "}")
|
||||
(when (and (part-style? d 'hidden-number)
|
||||
(not (part-style? d 'unnumbered)))
|
||||
|
@ -382,6 +385,10 @@
|
|||
(style-name es)
|
||||
es)]
|
||||
[style (and (style? es) es)]
|
||||
[hyperref? (and (link-element? e)
|
||||
(not (disable-hyperref))
|
||||
(let-values ([(dest ext?) (resolve-get/ext? part ri (link-element-tag e))])
|
||||
(and dest (not ext?))))]
|
||||
[check-render
|
||||
(lambda ()
|
||||
(when (render-element? e)
|
||||
|
@ -520,9 +527,15 @@
|
|||
(wrap e style-name 'exact)]
|
||||
[else
|
||||
(core-render e tt?)]))
|
||||
(when hyperref?
|
||||
(printf "\\hyperref[t:~a]{"
|
||||
(t-encode (link-element-tag e))))
|
||||
(let loop ([l (if style (style-properties style) null)] [tt? #f])
|
||||
(if (null? l)
|
||||
(finish tt?)
|
||||
(if hyperref?
|
||||
(parameterize ([disable-hyperref #t])
|
||||
(finish tt?))
|
||||
(finish tt?))
|
||||
(let ([v (car l)])
|
||||
(cond
|
||||
[(target-url? v)
|
||||
|
@ -560,7 +573,9 @@
|
|||
(loop (cdr l) tt?)
|
||||
(for ([l (in-list (command-extras-arguments (car l)))])
|
||||
(printf "{~a}" l))]
|
||||
[else (loop (cdr l) tt?)]))))))
|
||||
[else (loop (cdr l) tt?)]))))
|
||||
(when hyperref?
|
||||
(printf "}"))))
|
||||
(when part-label?
|
||||
(printf "}"))
|
||||
(when (and (link-element? e)
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
\newcommand{\BookRefLocalUN}[2]{\hyperref[#1]{\BookRefUN{#2}}}
|
||||
\newcommand{\ChapRefLocalUN}[2]{\SecRefLocalUN{#1}{#2}}
|
||||
\newcommand{\SecRefLocalUN}[2]{\SecRefUN{#2} on page~\pageref{#1}}
|
||||
\newcommand{\SecRefLocalUN}[2]{\hyperref[#1]{\SecRefUN{#2}}}
|
||||
\newcommand{\PartRefLocalUN}[2]{\SecRefLocalUN{#1}{#2}}
|
||||
\newcommand{\BookRefLocalUCUN}[2]{\BookRefLocalUN{#1}{#2}}
|
||||
\newcommand{\ChapRefLocalUCUN}[2]{\ChapRefLocalUN{#1}{#2}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user