Created
June 8, 2019 12:59
-
-
Save kmuto/965a41e26582b32cac6a559e6c46cfcc to your computer and use it in GitHub Desktop.
fboxで囲むreview-ext.rbの例
This file contains 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 LATEXBuilderOverride | |
def image_image(id, caption, metric) | |
metrics = parse_metric('latex', metric) | |
# image is always bound here | |
puts "\\begin{reviewimage}%%#{id}" | |
# ↓ここからが変更箇所 | |
# 要するに、includegraphicsを\fbox{}で囲んでいる | |
# 太さとかアキを変えたいときには、http://www3.otani.ac.jp/fkdsemi/pLaTeX_manual/kasen.html を参考にreview-custom.styに記述 | |
# 画像によって変えたいというときには、たとえばidを見てfboxで囲むかどうかを判定、みたいなロジックをここに加えればよい | |
if metrics.present? | |
puts "\\fbox{\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}}" | |
else | |
puts "\\fbox{\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}}" | |
end | |
# ↑ここまでが変更箇所 | |
@doc_status[:caption] = true | |
if @book.config.check_version('2', exception: false) | |
puts macro('caption', compile_inline(caption)) if caption.present? | |
else | |
puts macro('reviewimagecaption', compile_inline(caption)) if caption.present? | |
end | |
@doc_status[:caption] = nil | |
puts macro('label', image_label(id)) | |
puts '\end{reviewimage}' | |
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