Last active
February 2, 2020 14:44
-
-
Save kmuto/556a3dbcf8f3ee7d885767ca0556cdd0 to your computer and use it in GitHub Desktop.
dtのfootnoteの特例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ReVIEW | |
module CompilerOverride | |
def compile_dlist(f) | |
@strategy.dl_begin | |
while /\A\s*:/ =~ f.peek | |
if @strategy.class.to_s =~ /LATEX/ | |
s = f.gets | |
@strategy.dt(s.sub(/\A\s*:/, '').strip) | |
else | |
@strategy.dt(text(f.gets.sub(/\A\s*:/, '').strip)) | |
end | |
desc = f.break(/\A(\S|\s*:|\s+\d+\.\s|\s+\*\s)/).map { |line| text(line.strip) } | |
@strategy.dd(desc) | |
f.skip_blank_lines | |
f.skip_comment_lines | |
end | |
@strategy.dl_end | |
end | |
end | |
class Compiler | |
prepend CompilerOverride | |
end | |
module LATEXBuilderOverride | |
def dt(str) | |
str.sub!(/\[/) { '\lbrack{}' } | |
str.sub!(/\]/) { '\rbrack{}' } | |
@doc_status[:caption] = true | |
puts '\item[' + compile_inline(str) + '] \mbox{} \\\\' | |
@doc_status[:caption] = nil | |
end | |
end | |
class LATEXBuilder | |
prepend LATEXBuilderOverride | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment