scribble latex: work around `\href{...#...}{...}' as a macro argument
The `math' document build was failing because `\marginpar' does not like `\href{...#...}{...}' as an argument. original commit: 24f358a5d7afca40fcf734af94c2c94a80a817dc
This commit is contained in:
parent
f2c9297253
commit
e6d3862627
|
@ -391,12 +391,19 @@
|
||||||
(let ([v (car l)])
|
(let ([v (car l)])
|
||||||
(cond
|
(cond
|
||||||
[(target-url? v)
|
[(target-url? v)
|
||||||
(printf "\\href{~a}{" (regexp-replace* #rx"%"
|
(define target (regexp-replace* #rx"%"
|
||||||
(let ([p (target-url-addr v)])
|
(let ([p (target-url-addr v)])
|
||||||
(if (path? p)
|
(if (path? p)
|
||||||
(path->string p)
|
(path->string p)
|
||||||
p))
|
p))
|
||||||
"\\\\%"))
|
"\\\\%"))
|
||||||
|
(if (regexp-match? #rx"^[^#]*#[^#]*$" target)
|
||||||
|
;; work around a problem with `\href' as an
|
||||||
|
;; argument to other macros, such as `\marginpar':
|
||||||
|
(let ([l (string-split target "#")])
|
||||||
|
(printf "\\Shref{~a}{~a}{" (car l) (cadr l)))
|
||||||
|
;; normal:
|
||||||
|
(printf "\\href{~a}{" target))
|
||||||
(loop (cdr l) #t)
|
(loop (cdr l) #t)
|
||||||
(printf "}")]
|
(printf "}")]
|
||||||
[(color-property? v)
|
[(color-property? v)
|
||||||
|
|
|
@ -190,6 +190,10 @@
|
||||||
% Helper for box-mode macros:
|
% Helper for box-mode macros:
|
||||||
\newcommand{\Svcenter}[1]{$\vcenter{#1}$}
|
\newcommand{\Svcenter}[1]{$\vcenter{#1}$}
|
||||||
|
|
||||||
|
% Helper to work around a problem with "#"s for URLs within \href
|
||||||
|
% within other macros:
|
||||||
|
\newcommand{\Shref}[3]{\href{#1\##2}{#3}}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
% Scribble then generates the following:
|
% Scribble then generates the following:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user