Skip to content

Commit

Permalink
Add footnote with url to external links
Browse files Browse the repository at this point in the history
  • Loading branch information
Octachron committed Jul 1, 2020
1 parent c6500b5 commit edab964
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/latex/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ let escape_text ~code_hyphenation =
| '%' -> Buffer.add_string b "\\%"
| '~' -> Buffer.add_string b "\\textasciitilde{}"
| '^' -> Buffer.add_string b "\\textasciicircum{}"
| '_' -> Buffer.add_string b {|\_\allowbreak{}|}
| '_' ->
if code_hyphenation then Buffer.add_string b {|\_\allowbreak{}|}
else Buffer.add_string b {|\_|}
| '.' when code_hyphenation -> Buffer.add_string b {|.\allowbreak{}|}
| ';' when code_hyphenation -> Buffer.add_string b {|;\allowbreak{}|}
| ',' when code_hyphenation -> Buffer.add_string b {|,\allowbreak{}|}
Expand Down Expand Up @@ -307,10 +309,12 @@ and pp ppf = function
and hyperref ppf r = mhyperref pp r ppf

and href ppf (l,txt) =
let url ppf s = macro "url" Fmt.string ppf (escape_text ~code_hyphenation:false s) in
let footnote = macro "footnote" url in
match txt with
| Some txt ->
Fmt.pf ppf {|\href{%s}{%a}|} l pp txt
| None -> macro "url" Fmt.string ppf l
Fmt.pf ppf {|\href{%s}{%a}%a|} l pp txt footnote l
| None -> url ppf l

and large_table size ppf tbl =
let rec row ppf = function
Expand Down

0 comments on commit edab964

Please sign in to comment.