Skip to content

Instantly share code, notes, and snippets.

@zaki50
Created September 12, 2013 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaki50/6535460 to your computer and use it in GitHub Desktop.
Save zaki50/6535460 to your computer and use it in GitHub Desktop.
ReVIEW で表の中だと \footnote がうまく動かないのでその対処のための下調べ。 footnotetext を true にすれば脚注が \footnote ではなく \footnotemark と \footnotetext で生成されるようになる。これは表の中でも使えるがハイパーリンクにならないという欠点があったのでハイパーリンクになるようにしてみた。 最終的には footnotetext が false の時に、表の中にで使われている脚注だけ特別にハイパーリンク付きの \footnotetext と \footnotemark にするように実装したい
diff --git a/bin/review-compile b/bin/review-compile
index afea0d0..f0d3b6e 100755
--- a/bin/review-compile
+++ b/bin/review-compile
@@ -58,7 +58,7 @@ def _main
"mathml" => nil, # for HTML
"language" => "ja", # for HTML
"deprecated-blocklines" => nil,
- "footnotetext" => false,
+ "footnotetext" => true,
"htmlext" => "html",
"htmlversion" => 4,
}
diff --git a/lib/review/latexbuilder.rb b/lib/review/latexbuilder.rb
index 20f8d57..f54bf6f 100644
--- a/lib/review/latexbuilder.rb
+++ b/lib/review/latexbuilder.rb
@@ -599,13 +599,13 @@ module ReVIEW
def footnote(id, content)
if ReVIEW.book.param["footnotetext"]
puts macro("footnotetext[#{@chapter.footnote(id).number}]",
- compile_inline(content.strip))
+ macro('hypertarget', id, '') + compile_inline(content.strip))
end
end
def inline_fn(id)
if ReVIEW.book.param["footnotetext"]
- macro("footnotemark[#{@chapter.footnote(id).number}]", "")
+ macro("hyperlink", id, macro("footnotemark[#{@chapter.footnote(id).number}]", ""))
else
macro('footnote', compile_inline(@chapter.footnote(id).content.strip))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment