diff --git a/doc/config.yml.sample b/doc/config.yml.sample index df0e3bc7d..56804be63 100644 --- a/doc/config.yml.sample +++ b/doc/config.yml.sample @@ -5,7 +5,6 @@ # このファイルはUTF-8エンコーディングで記述してください。 # この設定ファイルでサポートするRe:VIEWのバージョン番号。 -# major versionが違うときにはエラーを出す。 review_version: 3.0 # ほかの設定ファイルの継承を指定できる。同じパラメータに異なる値がある場合は、 diff --git a/lib/review/configure.rb b/lib/review/configure.rb index 744386abe..3a71f06e1 100644 --- a/lib/review/configure.rb +++ b/lib/review/configure.rb @@ -105,9 +105,13 @@ def [](key) nil end - def check_version(version) + def check_version(version, exception: true) unless self.key?('review_version') - raise ReVIEW::ConfigError, 'configuration file has no review_version property.' + if exception + raise ReVIEW::ConfigError, 'configuration file has no review_version property.' + else + return false + end end if self['review_version'].blank? @@ -115,10 +119,19 @@ def check_version(version) end if self['review_version'].to_i != version.to_i ## major version - raise ReVIEW::ConfigError, 'major version of configuration file is different.' + if exception + raise ReVIEW::ConfigError, 'major version of configuration file is different.' + else + return false + end elsif self['review_version'].to_f > version.to_f ## minor version - raise ReVIEW::ConfigError, "Re:VIEW version '#{version}' is older than configuration file's version '#{self['review_version']}'." + if exception + raise ReVIEW::ConfigError, "Re:VIEW version '#{version}' is older than configuration file's version '#{self['review_version']}'." + else + return false + end end + return true end def name_of(key) diff --git a/lib/review/init.rb b/lib/review/init.rb index 707ee6785..65ca54dd4 100644 --- a/lib/review/init.rb +++ b/lib/review/init.rb @@ -17,6 +17,7 @@ def self.execute(*args) end def initialize + @template = 'review-jsbook' @logger = ReVIEW.logger @review_dir = File.dirname(File.expand_path('../../', __FILE__)) end @@ -54,6 +55,9 @@ def parse_options(args) opts.on('-l', '--locale', 'generate locale.yml file.') do @locale = true end + opts.on('--latex-template name', 'specify LaTeX template name. (default: review-jsbook)') do |tname| + @template = tname + end opts.on('', '--epub-version VERSION', 'define EPUB version') do |version| @epub_version = version end @@ -145,8 +149,9 @@ def generate_style(dir) def generate_texmacro(dir) texmacrodir = dir + '/sty' FileUtils.mkdir_p texmacrodir - FileUtils.cp [@review_dir + '/test/sample-book/src/sty/reviewmacro.sty', - @review_dir + '/test/sample-book/src/sty/jumoline.sty'], texmacrodir + tdir = File.join(@review_dir, '/templates/latex', @template) + @logger.error "#{tdir} not found." unless File.exist?(tdir) + FileUtils.cp Dir.glob(tdir + '/*.*'), texmacrodir end def generate_rakefile(dir) diff --git a/lib/review/latexbuilder.rb b/lib/review/latexbuilder.rb index 1d122f56f..00e901a4d 100644 --- a/lib/review/latexbuilder.rb +++ b/lib/review/latexbuilder.rb @@ -845,7 +845,7 @@ def compile_ruby(base, ruby) # math def inline_m(str) - if @book.config['review_version'].nil? || @book.config['review_version'].to_f > 2 + if @book.config.check_version('2', exception: false) "$#{str}$" else " $#{str}$ " @@ -859,7 +859,11 @@ def inline_hi(str) # index -> italic def inline_i(str) - macro('textit', escape(str)) + if @book.config.check_version('2', exception: false) + macro('textit', escape(str)) + else + macro('reviewit', escape(str)) + end end # index @@ -874,7 +878,11 @@ def inline_hidx(str) # bold def inline_b(str) - macro('textbf', escape(str)) + if @book.config.check_version('2', exception: false) + macro('textbf', escape(str)) + else + macro('reviewbold', escape(str)) + end end # line break @@ -889,7 +897,11 @@ def inline_dtp(_str) ## @ is same as @ def inline_code(str) - macro('texttt', escape(str)) + if @book.config.check_version('2', exception: false) + macro('texttt', escape(str)) + else + macro('reviewcode', escape(str)) + end end def nofunc_text(str) @@ -897,7 +909,11 @@ def nofunc_text(str) end def inline_tt(str) - macro('texttt', escape(str)) + if @book.config.check_version('2', exception: false) + macro('texttt', escape(str)) + else + macro('reviewtt', escape(str)) + end end def inline_del(str) @@ -905,11 +921,19 @@ def inline_del(str) end def inline_tti(str) - macro('texttt', macro('textit', escape(str))) + if @book.config.check_version('2', exception: false) + macro('texttt', macro('textit', escape(str))) + else + macro('reviewtti', escape(str)) + end end def inline_ttb(str) - macro('texttt', macro('textbf', escape(str))) + if @book.config.check_version('2', exception: false) + macro('texttt', macro('textbf', escape(str))) + else + macro('reviewttb', escape(str)) + end end def inline_bib(id) diff --git a/lib/review/pdfmaker.rb b/lib/review/pdfmaker.rb index cffc3304a..77ea5ba6f 100644 --- a/lib/review/pdfmaker.rb +++ b/lib/review/pdfmaker.rb @@ -228,6 +228,7 @@ def build_pdf def generate_pdf(yamlfile) remove_old_file + erb_config @path = build_path begin @compile_errors = nil @@ -248,6 +249,8 @@ def generate_pdf(yamlfile) copy_sty(File.join(Dir.pwd, 'sty'), @path) copy_sty(File.join(Dir.pwd, 'sty'), @path, 'fd') copy_sty(File.join(Dir.pwd, 'sty'), @path, 'cls') + copy_sty(File.join(Dir.pwd, 'sty'), @path, 'erb') + copy_sty(File.join(Dir.pwd, 'sty'), @path, 'tex') copy_sty(Dir.pwd, @path, 'tex') build_pdf @@ -366,7 +369,7 @@ def date_to_s(date) d.strftime(ReVIEW::I18n.t('date_format')) end - def template_content + def erb_config dclass = @config['texdocumentclass'] || [] @documentclass = dclass[0] || 'jsbook' @documentclassoption = dclass[1] || 'uplatex,oneside' @@ -409,20 +412,30 @@ def template_content @locale_latex['postchaptername'] = chapter_tuple[1] @locale_latex['preappendixname'] = appendix_tuple[0] @locale_latex['postappendixname'] = appendix_tuple[1] - - layout_file = File.join(@basedir, 'layouts', 'layout.tex.erb') - if File.exist?(layout_file) - template = layout_file - else - template = File.expand_path('./latex/layout.tex.erb', ReVIEW::Template::TEMPLATE_DIR) - end - @texcompiler = File.basename(@config['texcommand'], '.*') + end - erb = ReVIEW::Template.load(template, '-') + def erb_content(file) + @texcompiler = File.basename(@config['texcommand'], '.*') + erb = ReVIEW::Template.load(file, '-') + puts "erb processes #{File.basename(file)}" if @config['debug'] erb.result(binding) end + def latex_config + erb_content(File.expand_path('./latex/config.erb', ReVIEW::Template::TEMPLATE_DIR)) + end + + def template_content + template = File.expand_path('./latex/layout.tex.erb', ReVIEW::Template::TEMPLATE_DIR) + if @config['review_version'] && @config['review_version'].to_f < 3 + template = File.expand_path('./latex-compat2/layout.tex.erb', ReVIEW::Template::TEMPLATE_DIR) + end + layout_file = File.join(@basedir, 'layouts', 'layout.tex.erb') + template = layout_file if File.exist?(layout_file) + erb_content(template) + end + def copy_sty(dirname, copybase, extname = 'sty') unless File.directory?(dirname) warn "No such directory - #{dirname}" @@ -430,9 +443,14 @@ def copy_sty(dirname, copybase, extname = 'sty') end Dir.open(dirname) do |dir| - dir.each do |fname| - if File.extname(fname).downcase == '.' + extname - FileUtils.mkdir_p(copybase) + dir.sort.each do |fname| + next unless File.extname(fname).downcase == '.' + extname + FileUtils.mkdir_p(copybase) unless Dir.exist?(copybase) + if extname == 'erb' + File.open(File.join(copybase, fname.sub(/\.erb\Z/, '')), 'w') do |f| + f.print erb_content(File.join(dirname, fname)) + end + else FileUtils.cp File.join(dirname, fname), copybase end end diff --git a/templates/latex-compat2/layout.tex.erb b/templates/latex-compat2/layout.tex.erb new file mode 100644 index 000000000..20cb43c68 --- /dev/null +++ b/templates/latex-compat2/layout.tex.erb @@ -0,0 +1,386 @@ +\documentclass[dvipdfmx,<%= @documentclassoption %>]{<%= @documentclass %>} +% %% fixes to LaTeX2e +% \usepackage{fix-cm}[2006/09/13 v1.1m] +% \usepackage{fixltx2e}[2006/09/13 v1.1m] + +<%- if @texcompiler == "uplatex" -%> +\usepackage[deluxe,uplatex]{otf} +<%- else -%> +\usepackage[deluxe]{otf} +<%- end -%> +\usepackage{caption} +\usepackage{suffix} +\usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1 +\usepackage{lmodern} +\usepackage[dvipdfmx]{graphicx} +\usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array +\usepackage{framed} +\usepackage{wrapfig} +\definecolor{shadecolor}{gray}{0.9} +\definecolor{shadecolorb}{gray}{0.1} +\definecolor{reviewgreen}{rgb}{0,0.4,0} +\definecolor{reviewblue}{rgb}{0.2,0.2,0.4} +\definecolor{reviewred}{rgb}{0.7,0,0} +\definecolor{reviewdarkred}{rgb}{0.3,0,0} +\usepackage[utf8]{inputenc} +\usepackage{ascmac} +\usepackage{float} +\usepackage{alltt} +\usepackage{amsmath} + +%% if you use @{} (underline), use jumoline.sty +\IfFileExists{jumoline.sty}{ +\usepackage{jumoline} +} + +\newenvironment{shadedb}{% + \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolorb}}% + \MakeFramed {\FrameRestore}}% + {\endMakeFramed} + +<%- unless ["utbook", "tbook"].include?(@documentclass) -%> +\usepackage[top=10zw,bottom=12zw,left=10zw,right=10zw]{geometry} +%\usepackage[top=5zw,bottom=5zw,left=1zw,right=1zw]{geometry} +<%- end -%> + +\newcommand{\parasep}{\vspace*{3zh}} +\setlength{\footskip}{30pt} + +%% Bookmarkの文字化け対策(日本語向け) +\usepackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true,colorlinks=true,% + pdftitle={<%= escape_latex(@config.name_of("booktitle")) %>},% + pdfauthor={<%= escape_latex(@config.names_of("aut").join(I18n.t("names_splitter"))) %>}]{hyperref} +\usepackage[dvipdfmx]{pxjahyper} + +<%- if ["utbook", "tbook"].include?(@documentclass) -%> +\newcommand{\headfont}{\gtfamily\sffamily\bfseries} +\usepackage{plext} +<%- end -%> + +<%- if config["highlight"] && config["highlight"]["latex"] == "listings" -%> +<%- if config["language"] == "ja" -%> +\usepackage{listings,jlisting} +<%- else -%> +\usepackage{listings} +<%- end -%> +\renewcommand{\lstlistingname}{<%= escape_latex(I18n.t("list")) %>} +\lstset{% + breaklines=true,% + breakautoindent=false,% + breakindent=0pt,% + fontadjust=true,% + backgroundcolor=\color{shadecolor},% + frame=single,% + framerule=0pt,% + basicstyle=\ttfamily\scriptsize,% + commentstyle=\color{reviewgreen},% + identifierstyle=\color{reviewblue},% + stringstyle=\color{reviewred},% + keywordstyle=\bfseries\color{reviewdarkred},% +} + +\lstnewenvironment{reviewemlistlst}[1][]{\lstset{#1}}{} +\lstnewenvironment{reviewemlistnumlst}[1][]{\lstset{numbers=left, #1}}{} +\lstnewenvironment{reviewlistlst}[1][]{\lstset{#1}}{} +\lstnewenvironment{reviewlistnumlst}[1][]{\lstset{numbers=left, #1}}{} +\lstnewenvironment{reviewsourcelst}[1][]{\lstset{#1}}{} +\lstnewenvironment{reviewsourcenumlst}[1][]{\lstset{numbers=left, #1}}{} +\lstnewenvironment{reviewcmdlst}[1][]{\lstset{backgroundcolor=\color{white}, frameround=tttt, frame=trbl, #1}}{} +<%- end -%> + +\newenvironment{reviewimage}{% + \begin{figure}[H] + \begin{center}}{% + \end{center} + \end{figure}} + +\newenvironment{reviewdummyimage}{% + \begin{figure}[H] + \begin{center}\begin{alltt}}{% + \end{alltt}\end{center} + \end{figure}} + +\newenvironment{reviewemlist}{% + \medskip\small\begin{shaded}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}} + +\newenvironment{reviewlist}{% + \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}\par\vspace*{0.5zw}} + +\newenvironment{reviewsource}{% + \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}\par\vspace*{0.5zw}} + +\newenvironment{reviewcmd}{% + \color{white}\medskip\small\begin{shadedb}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shadedb}} + +\newenvironment{reviewbox}{% + \medskip\small\begin{framed}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{framed}} + +\newenvironment{reviewtable}[1]{% + \begin{center}\small\setlength{\baselineskip}{1.2zw} + \begin{tabular}{#1}}{% + \end{tabular} + \end{center}} + +\newenvironment{reviewcolumn}{% + \begin{framed} + }{% + \end{framed} + \vspace{2zw}} + +\newcommand{\reviewcolumnhead}[2]{% +{\noindent\large <%= escape_latex(I18n.t("column_head"))%>: #2}} + +\newcommand{\reviewtablecaption}[1]{% + \caption{#1}} + +\WithSuffix\newcommand\reviewtablecaption*[1]{% + \caption*{#1}} + +\newcommand{\reviewimgtablecaption}[1]{% + \caption{#1}\vspace{-3mm}} + +\newcommand{\reviewbackslash}[0]{% + \textbackslash{}} + +\newcommand{\reviewlistcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewemlistcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewsourcecaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewcmdcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewindepimagecaption}[1]{% + \begin{center}#1\end{center}} + +\newcommand{\reviewboxcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewimageref}[2]{<%= escape_latex(I18n.t("image"))%> #1} +\newcommand{\reviewtableref}[2]{<%= escape_latex(I18n.t("table"))%> #1} +\newcommand{\reviewlistref}[1]{<%= escape_latex(I18n.t("list"))%> #1} +\newcommand{\reviewbibref}[2]{#1} +\newcommand{\reviewcolumnref}[2]{<%= escape_latex(I18n.t("columnname"))%> #1} +\newcommand{\reviewsecref}[2]{#1} + +\newcommand{\reviewminicolumntitle}[1]{% + {\large <%= escape_latex(I18n.t("memo_head"))%>: #1}\\} + +<%- if @config["toctitle"].present? -%> +\renewcommand{\contentsname}{<%= escape_latex(@config["toctitle"]) %>} +<%- elsif I18n.t("toctitle") -%> +\renewcommand{\contentsname}{<%= escape_latex(I18n.t("toctitle")) %>} +<%- end -%> + +\newenvironment{reviewminicolumn}{% + \vspace{1.5zw}\begin{screen}}{% + \end{screen}\vspace{2zw}} + +\newcommand{\reviewkw}[1]{\textbf{\textgt{#1}}} +\newcommand{\reviewami}[1]{\mask{#1}{A}} +\newcommand{\reviewem}[1]{\textbf{#1}} +\newcommand{\reviewstrong}[1]{\textbf{#1}} +\newcommand{\reviewunderline}{\Underline} + +%% @ is ignored in LaTeX with default style +\newcommand{\reviewstrike}[1]{#1} + +%%%% for ulem.sty: +%%\renewcommand{\reviewstrike}[1]{\sout{#1}} +%% +%%%% for jumoline.sty: +%%\renewcommand{\reviewstrike}[1]{\Middleline{#1}} + +\newcommand{\reviewth}[1]{\textgt{#1}} +\newcommand{\reviewtitlefont}[0]{\usefont{T1}{phv}{b}{n}\gtfamily} +\newcommand{\reviewmainfont}[0]{} +\newcommand{\reviewcolophon}[0]{\clearpage} +\newcommand{\reviewappendix}[0]{\appendix} + +\newcommand{\reviewprepartname}{<%= escape_latex(@locale_latex["prepartname"]) %>} +\newcommand{\reviewpostpartname}{<%= escape_latex(@locale_latex["postpartname"]) %>} +\newcommand{\reviewprechaptername}{<%= escape_latex(@locale_latex["prechaptername"]) %>} +\newcommand{\reviewpostchaptername}{<%= escape_latex(@locale_latex["postchaptername"]) %>} +\newcommand{\reviewfigurename}{<%= escape_latex(I18n.t("image")) %>} +\newcommand{\reviewtablename}{<%= escape_latex(I18n.t("table")) %>} +\newcommand{\reviewappendixname}{<%= escape_latex(@locale_latex["preappendixname"]) %>} + +\ifdefined\prepartname + \renewcommand{\prepartname}{\reviewprepartname} +\fi +\ifdefined\postpartname + \renewcommand{\postpartname}{\reviewpostpartname} +\fi +\ifdefined\prechaptername + \renewcommand{\prechaptername}{\reviewprechaptername} +\fi +\ifdefined\postchaptername + \renewcommand{\postchaptername}{\reviewpostchaptername} +\fi +\ifdefined\figurename + \renewcommand{\figurename}{\reviewfigurename} +\fi +\ifdefined\tablename + \renewcommand{\tablename}{\reviewtablename} +\fi +\ifdefined\appendixname + \renewcommand{\appendixname}{\reviewappendixname} +\fi + + +\makeatletter +%% maxwidth is the original width if it is less than linewidth +%% otherwise use linewidth (to make sure the graphics do not exceed the margin) +\def\maxwidth{% + \ifdim\Gin@nat@width>\linewidth + \linewidth + \else + \Gin@nat@width + \fi +} +\makeatother + +<%- if @config["texstyle"] -%> +<%- [@config["texstyle"]].flatten.each do |x| -%> +\usepackage{<%= x %>} +<%- end -%> +<%- end -%> +<%- if @config["makeindex"] -%> +\usepackage{makeidx} +\makeindex +<%- end -%> + +\begin{document} + +\reviewmainfont + +<%- if @config["titlepage"] -%> +<%- if @custom_titlepage -%> +<%= @custom_titlepage %> +<%- else -%> +\begin{titlepage} +<%- if @config["coverimage"] -%> + \begin{center} + \includegraphics[<%= @coverimageoption%>]{./<%= @config["imagedir"] %>/<%= @config["coverimage"] %>} + \end{center} + \clearpage +<%- end -%> +\thispagestyle{empty} +\begin{center}% + \mbox{} \vskip5zw + \reviewtitlefont% + {\Huge <%= escape_latex(@config.name_of("booktitle")) %> \par}% +<%- if @config["subtitle"] -%> + \vskip 1em% + {\Large <%= escape_latex(@config.name_of("subtitle")) %> \par}% +<%- end -%> + \vskip 15em% + {\huge + \lineskip .75em + \begin{tabular}[t]{c}% + <%= @authors %> + \end{tabular}\par}% + \vfill + {\large <%= escape_latex(@config["date"].to_s) %> <%= escape_latex(I18n.t("edition")) %>\hspace{2zw}<%= escape_latex(I18n.t("published_by", @config.names_of("pbl").join(I18n.t("names_splitter"))))%>\par}% +\vskip4zw\mbox{} + \end{center}% +\end{titlepage} +<%- end -%> +<%- end -%> + +\renewcommand{\chaptermark}[1]{{}} +\frontmatter + +%%% originaltitle +<%- if @config["originaltitlefile"] -%> +<%= @custom_originaltitlepage %> +<%- end -%> + +%%% credit +<%- if @config["creditfile"] -%> +<%= @custom_creditpage %> +<%- end -%> + +%% preface +<%= @input_files["PREDEF"] %> + +<%- if @config["toc"] -%> +\setcounter{tocdepth}{<%= @config["toclevel"] - 1 %>} +\tableofcontents +<%- end -%> + +\renewcommand{\chaptermark}[1]{\markboth{\prechaptername\thechapter\postchaptername~#1}{}} +\mainmatter +<%= @input_files["CHAPS"] %> +\renewcommand{\chaptermark}[1]{\markboth{\appendixname\thechapter~#1}{}} +\reviewappendix +<%= @input_files["APPENDIX"] %> + +%% backmatter begins +<%- if @input_files["POSTDEF"] or @config["colophon"] -%> +\backmatter +<%- end -%> + +<%- if @input_files["POSTDEF"] -%> +<%= @input_files["POSTDEF"] %> +<%- end -%> +<%- if @config["pdfmaker"]["makeindex"] -%> +\printindex +<%- end -%> + +%%% profile +<%- if @config["profile"] -%> +<%= @custom_profilepage %> +<%- end -%> + +%%% advfile +<%- if @config["advfile"] -%> +<%= @custom_advfilepage %> +<%- end -%> + +%%% colophon +<%- if @config["colophon"] -%> +<%- if @custom_colophonpage -%> +<%= @custom_colophonpage %> +<%- else -%> +%% okuduke +\reviewcolophon +\thispagestyle{empty} + +\vspace*{\fill} + +{\noindent\reviewtitlefont\Large <%= escape_latex(@config.name_of("booktitle")) %>} \\ +<%- if @config["subtitle"] -%> +{\noindent\reviewtitlefont\large <%= escape_latex(@config.name_of("subtitle")) %>} \\ +<%- end -%> +\rule[8pt]{\textwidth}{1pt} \\ +{\noindent +<%= @config["pubhistory"].to_s.gsub(/\n/){"\n\n\\noindent\n"} %> +} + +\begin{tabular}{ll} +<%= @okuduke %> +\end{tabular} + \\ +\rule[0pt]{\textwidth}{1pt} \\ +<%- if @config["rights"] -%> +<%= @config.names_of("rights").map{|s| escape_latex(s)}.join('\\' + '\\') %> \\ +<%- end -%> +<%- end -%> +<%- end -%> + +%%% backcover +<%- if @config["backcover"] -%> +<%= @custom_backcoverpage %> +<%- end -%> + +\end{document} diff --git a/templates/latex/config.erb b/templates/latex/config.erb new file mode 100644 index 000000000..e01ff3da3 --- /dev/null +++ b/templates/latex/config.erb @@ -0,0 +1,83 @@ +\makeatletter +\def\review@texcompiler{<%= @texcompiler %>} +\def\review@documentclass{<%= @documentclass %>} +\def\review@booktitle_name{<%= escape_latex(@config.name_of('booktitle')) %>} +<%- if @config['subtitle'] -%> +\def\review@subtitle_name{<%= escape_latex(@config.name_of('subtitle')) %>} +<%- end -%> +\def\review@aut_names{<%= escape_latex(@config.names_of('aut').join(I18n.t('names_splitter'))) %>} +\def\review@titlepageauthors{<%= @authors %>} +\def\review@date{<%= escape_latex(@config['date'].to_s) %>} +<%- if @config['highlight'] && @config['highlight']['latex'] -%> +\def\review@highlight_latex{<%= @config['highlight']['latex'] %>} +<%- end -%> +\def\review@language{<%= @config['language'] %>} +\def\review@intn@list{<%= escape_latex(I18n.t('list')) %>} +\def\review@intn@column_head{<%= escape_latex(I18n.t('column_head')) %>} +\def\review@intn@image{<%= escape_latex(I18n.t('image')) %>} +\def\review@intn@table{<%= escape_latex(I18n.t('table')) %>} +\def\review@intn@columnname{<%= escape_latex(I18n.t('columnname')) %>} +\def\review@intn@memo_head{<%= escape_latex(I18n.t('memo_head')) %>} +\def\review@intn@edition{<%= escape_latex(I18n.t('edition')) %>} +\def\review@intn@published_by{<%= escape_latex(I18n.t('published_by', @config.names_of('pbl').join(I18n.t('names_splitter'))))%>} +\def\review@toctitle{<%= escape_latex(@config['toctitle'].present? ? @config['toctitle'] : I18n.t('toctitle')) %>} +\def\review@prepartname{<%= escape_latex(@locale_latex['prepartname']) %>} +\def\review@postpartname{<%= escape_latex(@locale_latex['postpartname']) %>} +\def\review@prechaptername{<%= escape_latex(@locale_latex['prechaptername']) %>} +\def\review@postchaptername{<%= escape_latex(@locale_latex['postchaptername']) %>} +\def\review@figurename{<%= escape_latex(I18n.t('image')) %>} +\def\review@tablename{<%= escape_latex(I18n.t('table')) %>} +\def\review@appendixname{<%= escape_latex(@locale_latex['preappendixname']) %>} +<%- if @config['toc'] -%> +\def\review@toc{true} +\def\review@tocdepth{<%= @config['toclevel'] - 1 %>} +<%- end -%> +<%- if @config['makeindex'] -%> +\def\review@makeindex{true} +<%- end -%> +<%- if @config['cover'] -%> +\def\review@coverfile{<%= File.read(@config['cover']) %>} +<%- elsif @config['coverimage'] -%> +\def\review@coverimage{./<%= @config['imagedir'] %>/<%= @config['coverimage'] %>} +\def\review@coverimageoption{<%= @coverimageoption%>} +<%- end -%> +<%- if @config['titlepage'] -%> +\def\review@titlepage{true} +<%- if @config['titlefile'] -%> +\def\review@titlefile{<%= File.read(@config['titlefile']) %>} +<%- end -%> +<%- end -%> +<%- if @custom_originaltitlepage -%> +\def\revieworiginaltitlepagecont{<%= @custom_originaltitlepage %>} +<%- end -%> +<%- if @custom_creditpage -%> +\def\reviewcreditfilecont{<%= @custom_creditpage %>} +<%- end -%> +<%- if @custom_profilepage -%> +\def\reviewprofilepagecont{<%= @custom_profilepage %>} +<%- end -%> +<%- if @custom_advfilepage -%> +\def\reviewadvfilepagecont{<%= @custom_advfilepage %>} +<%- end -%> +<%- if @custom_backcoverpage -%> +\def\reviewbackcovercont{<%= @custom_backcoverpage %>} +<%- end -%> + +<%- if @config['colophon'] && @config['colophon'] -%> +\def\review@colophon{true} +<%- if @custom_colophonpage -%> +\def\review@colophonfile{<%= @custom_colophonpage %>} +<%- end -%> +<%- end -%> +\def\review@pubhistories{<%= @config['pubhistory'].to_s.gsub(/\n/){"\n\n\\noindent\n"} %>} +\def\review@colophon_names{<%= @okuduke %>} +<%- if @config['rights'] -%> +\def\review@rights{<%= @config.names_of('rights').map{|s| escape_latex(s)}.join('\\' + '\\') %>} +<%- end -%> + +\def\reviewprefacefiles{<%= @input_files['PREDEF'] %>} +\def\reviewchapterfiles{<%= @input_files['CHAPS'] %>} +\def\reviewappendixfiles{<%= @input_files['APPENDIX'] %>} +\def\reviewpostdeffiles{<%= @input_files['POSTDEF'] %>} + +\makeatother diff --git a/templates/latex/layout.tex.erb b/templates/latex/layout.tex.erb index 1e75ac9ae..59ae254f0 100644 --- a/templates/latex/layout.tex.erb +++ b/templates/latex/layout.tex.erb @@ -1,390 +1,101 @@ \documentclass[dvipdfmx,<%= @documentclassoption %>]{<%= @documentclass %>} -% %% fixes to LaTeX2e -% \usepackage{fix-cm}[2006/09/13 v1.1m] -% \usepackage{fixltx2e}[2006/09/13 v1.1m] - -<%- if @texcompiler == "uplatex" -%> -\usepackage[deluxe,uplatex]{otf} -<%- else -%> -\usepackage[deluxe]{otf} -<%- end -%> -\usepackage{caption} -\usepackage{suffix} -\usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1 -\usepackage{lmodern} -\usepackage[dvipdfmx]{graphicx} -\usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array -\usepackage{framed} -\usepackage{wrapfig} -\definecolor{shadecolor}{gray}{0.9} -\definecolor{shadecolorb}{gray}{0.1} -\definecolor{reviewgreen}{rgb}{0,0.4,0} -\definecolor{reviewblue}{rgb}{0.2,0.2,0.4} -\definecolor{reviewred}{rgb}{0.7,0,0} -\definecolor{reviewdarkred}{rgb}{0.3,0,0} -\usepackage[utf8]{inputenc} -\usepackage{ascmac} -\usepackage{float} -\usepackage{alltt} -\usepackage{amsmath} - -%% if you use @{} (underline), use jumoline.sty -\IfFileExists{jumoline.sty}{ -\usepackage{jumoline} -} - -\newenvironment{shadedb}{% - \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolorb}}% - \MakeFramed {\FrameRestore}}% - {\endMakeFramed} - -<%- unless ["utbook", "tbook"].include?(@documentclass) -%> -\usepackage[top=10zw,bottom=12zw,left=10zw,right=10zw]{geometry} -%\usepackage[top=5zw,bottom=5zw,left=1zw,right=1zw]{geometry} -<%- end -%> - -\newcommand{\parasep}{\vspace*{3zh}} -\setlength{\footskip}{30pt} - -%% Bookmarkの文字化け対策(日本語向け) -\usepackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true,colorlinks=true,% - pdftitle={<%= escape_latex(@config.name_of("booktitle")) %>},% - pdfauthor={<%= escape_latex(@config.names_of("aut").join(I18n.t("names_splitter"))) %>}]{hyperref} -\usepackage[dvipdfmx]{pxjahyper} - -<%- if ["utbook", "tbook"].include?(@documentclass) -%> -\newcommand{\headfont}{\gtfamily\sffamily\bfseries} -\usepackage{plext} -<%- end -%> - -<%- if config["highlight"] && config["highlight"]["latex"] == "listings" -%> -<%- if config["language"] == "ja" -%> -\usepackage{listings,jlisting} -<%- else -%> -\usepackage{listings} -<%- end -%> -\renewcommand{\lstlistingname}{<%= escape_latex(I18n.t("list")) %>} -\lstset{% - breaklines=true,% - breakautoindent=false,% - breakindent=0pt,% - fontadjust=true,% - backgroundcolor=\color{shadecolor},% - frame=single,% - framerule=0pt,% - basicstyle=\ttfamily\scriptsize,% - commentstyle=\color{reviewgreen},% - identifierstyle=\color{reviewblue},% - stringstyle=\color{reviewred},% - keywordstyle=\bfseries\color{reviewdarkred},% -} - -\lstnewenvironment{reviewemlistlst}[1][]{\lstset{#1}}{} -\lstnewenvironment{reviewemlistnumlst}[1][]{\lstset{numbers=left, #1}}{} -\lstnewenvironment{reviewlistlst}[1][]{\lstset{#1}}{} -\lstnewenvironment{reviewlistnumlst}[1][]{\lstset{numbers=left, #1}}{} -\lstnewenvironment{reviewsourcelst}[1][]{\lstset{#1}}{} -\lstnewenvironment{reviewsourcenumlst}[1][]{\lstset{numbers=left, #1}}{} -\lstnewenvironment{reviewcmdlst}[1][]{\lstset{backgroundcolor=\color{white}, frameround=tttt, frame=trbl, #1}}{} -<%- end -%> - -\newenvironment{reviewimage}{% - \begin{figure}[H] - \begin{center}}{% - \end{center} - \end{figure}} - -\newenvironment{reviewdummyimage}{% - \begin{figure}[H] - \begin{center}\begin{alltt}}{% - \end{alltt}\end{center} - \end{figure}} - -\newenvironment{reviewemlist}{% - \medskip\small\begin{shaded}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}} - -\newenvironment{reviewlist}{% - \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}\par\vspace*{0.5zw}} - -\newenvironment{reviewsource}{% - \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}\par\vspace*{0.5zw}} - -\newenvironment{reviewcmd}{% - \color{white}\medskip\small\begin{shadedb}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shadedb}} - -\newenvironment{reviewbox}{% - \medskip\small\begin{framed}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{framed}} - -\newenvironment{reviewtable}[1]{% - \begin{center}\small\setlength{\baselineskip}{1.2zw} - \begin{tabular}{#1}}{% - \end{tabular} - \end{center}} - -\newenvironment{reviewcolumn}{% - \begin{framed} - }{% - \end{framed} - \vspace{2zw}} - -\newcommand{\reviewcolumnhead}[2]{% -{\noindent\large <%= escape_latex(I18n.t("column_head"))%>: #2}} - -\newcommand{\reviewtablecaption}[1]{% - \caption{#1}} - -\WithSuffix\newcommand\reviewtablecaption*[1]{% - \caption*{#1}} - -\newcommand{\reviewimgtablecaption}[1]{% - \caption{#1}\vspace{-3mm}} - -\newcommand{\reviewbackslash}[0]{% - \textbackslash{}} - -\newcommand{\reviewlistcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewemlistcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewsourcecaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewcmdcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewindepimagecaption}[1]{% - \begin{center}#1\end{center}} - -\newcommand{\reviewboxcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewimageref}[2]{<%= escape_latex(I18n.t("image"))%> #1} -\newcommand{\reviewtableref}[2]{<%= escape_latex(I18n.t("table"))%> #1} -\newcommand{\reviewlistref}[1]{<%= escape_latex(I18n.t("list"))%> #1} -\newcommand{\reviewbibref}[2]{#1} -\newcommand{\reviewcolumnref}[2]{<%= escape_latex(I18n.t("columnname"))%> #1} -\newcommand{\reviewsecref}[2]{#1} - -\newcommand{\reviewminicolumntitle}[1]{% - {\large <%= escape_latex(I18n.t("memo_head"))%>: #1}\\} - -<%- if @config["toctitle"].present? -%> -\renewcommand{\contentsname}{<%= escape_latex(@config["toctitle"]) %>} -<%- elsif I18n.t("toctitle") -%> -\renewcommand{\contentsname}{<%= escape_latex(I18n.t("toctitle")) %>} -<%- end -%> - -\newenvironment{reviewminicolumn}{% - \vspace{1.5zw}\begin{screen}}{% - \end{screen}\vspace{2zw}} - -\newcommand{\reviewkw}[1]{\textbf{\textgt{#1}}} -\newcommand{\reviewami}[1]{\mask{#1}{A}} -\newcommand{\reviewem}[1]{\textbf{#1}} -\newcommand{\reviewstrong}[1]{\textbf{#1}} -\newcommand{\reviewunderline}{\Underline} - -%% @ is ignored in LaTeX with default style -\newcommand{\reviewstrike}[1]{#1} - -%%%% for ulem.sty: -%%\renewcommand{\reviewstrike}[1]{\sout{#1}} -%% -%%%% for jumoline.sty: -%%\renewcommand{\reviewstrike}[1]{\Middleline{#1}} - -\newcommand{\reviewth}[1]{\textgt{#1}} -\newcommand{\reviewtitlefont}[0]{\usefont{T1}{phv}{b}{n}\gtfamily} -\newcommand{\reviewmainfont}[0]{} -\newcommand{\reviewcolophon}[0]{\clearpage} -\newcommand{\reviewappendix}[0]{\appendix} - -\newcommand{\reviewprepartname}{<%= escape_latex(@locale_latex["prepartname"]) %>} -\newcommand{\reviewpostpartname}{<%= escape_latex(@locale_latex["postpartname"]) %>} -\newcommand{\reviewprechaptername}{<%= escape_latex(@locale_latex["prechaptername"]) %>} -\newcommand{\reviewpostchaptername}{<%= escape_latex(@locale_latex["postchaptername"]) %>} -\newcommand{\reviewfigurename}{<%= escape_latex(I18n.t("image")) %>} -\newcommand{\reviewtablename}{<%= escape_latex(I18n.t("table")) %>} -\newcommand{\reviewappendixname}{<%= escape_latex(@locale_latex["preappendixname"]) %>} - -\ifdefined\prepartname - \renewcommand{\prepartname}{\reviewprepartname} -\fi -\ifdefined\postpartname - \renewcommand{\postpartname}{\reviewpostpartname} -\fi -\ifdefined\prechaptername - \renewcommand{\prechaptername}{\reviewprechaptername} -\fi -\ifdefined\postchaptername - \renewcommand{\postchaptername}{\reviewpostchaptername} -\fi -\ifdefined\figurename - \renewcommand{\figurename}{\reviewfigurename} -\fi -\ifdefined\tablename - \renewcommand{\tablename}{\reviewtablename} -\fi -\ifdefined\appendixname - \renewcommand{\appendixname}{\reviewappendixname} -\fi - - -\makeatletter -%% maxwidth is the original width if it is less than linewidth -%% otherwise use linewidth (to make sure the graphics do not exceed the margin) -\def\maxwidth{% - \ifdim\Gin@nat@width>\linewidth - \linewidth - \else - \Gin@nat@width - \fi -} -\makeatother - -<%- if @config["texstyle"] -%> -<%- [@config["texstyle"]].flatten.each do |x| -%> +<%= latex_config %> +<%- if @config['texstyle'] -%> +<%- [@config['texstyle']].flatten.each do |x| -%> \usepackage{<%= x %>} <%- end -%> <%- end -%> -<%- if @config["makeindex"] -%> -\usepackage{makeidx} -\makeindex -<%- end -%> \begin{document} -\reviewmainfont +%% coverpage +\ifdefined\reviewcoverpagecont +\reviewcoverpagecont +\fi -<%- if @config["cover"] -%> -<%= @custom_coverpage %> -<%- elsif @config["coverimage"] -%> -\begin{titlepage} - \begin{center} - \includegraphics[<%= @coverimageoption%>]{./<%= @config["imagedir"] %>/<%= @config["coverimage"] %>} - \end{center} -\end{titlepage} - \clearpage -<%- end -%> -<%- if @config["titlepage"] -%> -<%- if @custom_titlepage -%> -<%= @custom_titlepage %> -<%- else -%> -\begin{titlepage} -\thispagestyle{empty} -\begin{center}% - \mbox{} \vskip5zw - \reviewtitlefont% - {\Huge <%= escape_latex(@config.name_of("booktitle")) %> \par}% -<%- if @config["subtitle"] -%> - \vskip 1em% - {\Large <%= escape_latex(@config.name_of("subtitle")) %> \par}% -<%- end -%> - \vskip 15em% - {\huge - \lineskip .75em - \begin{tabular}[t]{c}% - <%= @authors %> - \end{tabular}\par}% - \vfill - {\large <%= escape_latex(@config["date"].to_s) %> <%= escape_latex(I18n.t("edition")) %>\hspace{2zw}<%= escape_latex(I18n.t("published_by", @config.names_of("pbl").join(I18n.t("names_splitter"))))%>\par}% -\vskip4zw\mbox{} - \end{center}% -\end{titlepage} -<%- end -%> -<%- end -%> +%% title page +\ifdefined\reviewtitlepagecont +\reviewtitlepagecont +\fi -\renewcommand{\chaptermark}[1]{{}} -\frontmatter +%% frontmatter hook +\ifdefined\reviewfrontmatterhook +\reviewfrontmatterhook +\fi -%%% originaltitle -<%- if @config["originaltitlefile"] -%> -<%= @custom_originaltitlepage %> -<%- end -%> +%% originaltitle +\ifdefined\revieworiginaltitlepagecont +\revieworiginaltitlepagecont +\fi -%%% credit -<%- if @config["creditfile"] -%> -<%= @custom_creditpage %> -<%- end -%> +%% credit +\ifdefined\reviewcreditfilecont +\reviewcreditfilecont +\fi %% preface -<%= @input_files["PREDEF"] %> +\ifdefined\reviewprefacefiles +\reviewprefacefiles +\fi -<%- if @config["toc"] -%> -\setcounter{tocdepth}{<%= @config["toclevel"] - 1 %>} -\tableofcontents -<%- end -%> +%% toc +\ifdefined\reviewtableofcontents +\reviewtableofcontents +\fi -\renewcommand{\chaptermark}[1]{\markboth{\prechaptername\thechapter\postchaptername~#1}{}} -\mainmatter -<%= @input_files["CHAPS"] %> -\renewcommand{\chaptermark}[1]{\markboth{\appendixname\thechapter~#1}{}} -\reviewappendix -<%= @input_files["APPENDIX"] %> +%% mainmatter hook +\ifdefined\reviewmainmatterhook +\reviewmainmatterhook +\fi -%% backmatter begins -<%- if @input_files["POSTDEF"] or @config["colophon"] -%> -\backmatter -<%- end -%> +%% chapters body +\ifdefined\reviewchapterfiles +\reviewchapterfiles +\fi -<%- if @input_files["POSTDEF"] -%> -<%= @input_files["POSTDEF"] %> -<%- end -%> -<%- if @config["pdfmaker"]["makeindex"] -%> -\printindex -<%- end -%> +%% appendix hook +\ifdefined\reviewappendixhook +\reviewappendixhook +\fi -%%% profile -<%- if @config["profile"] -%> -<%= @custom_profilepage %> -<%- end -%> +%% appendix body +\ifdefined\reviewappendixfiles +\reviewappendixfiles +\fi -%%% advfile -<%- if @config["advfile"] -%> -<%= @custom_advfilepage %> -<%- end -%> +%% backmatter hook +\ifdefined\reviewbackmatterhook +\reviewbackmatterhook +\fi -%%% colophon -<%- if @config["colophon"] -%> -<%- if @custom_colophonpage -%> -<%= @custom_colophonpage %> -<%- else -%> -%% okuduke -\reviewcolophon -\thispagestyle{empty} +%% postdef body +\ifdefined\reviewpostdeffiles +\reviewpostdeffiles +\fi -\vspace*{\fill} +%% index page +\ifdefined\reviewprintindex +\reviewprintindex +\fi -{\noindent\reviewtitlefont\Large <%= escape_latex(@config.name_of("booktitle")) %>} \\ -<%- if @config["subtitle"] -%> -{\noindent\reviewtitlefont\large <%= escape_latex(@config.name_of("subtitle")) %>} \\ -<%- end -%> -\rule[8pt]{\textwidth}{1pt} \\ -{\noindent -<%= @config["pubhistory"].to_s.gsub(/\n/){"\n\n\\noindent\n"} %> -} +%% profile page +\ifdefined\reviewprofilepagecont +\reviewprofilepagecont +\fi -\begin{tabular}{ll} -<%= @okuduke %> -\end{tabular} - \\ -\rule[0pt]{\textwidth}{1pt} \\ -<%- if @config["rights"] -%> -<%= @config.names_of("rights").map{|s| escape_latex(s)}.join('\\' + '\\') %> \\ -<%- end -%> -<%- end -%> -<%- end -%> +%% advfile page +\ifdefined\reviewadvfilepagecont +\reviewadvfilepagecont +\fi -%%% backcover -<%- if @config["backcover"] -%> -<%= @custom_backcoverpage %> -<%- end -%> +%%% colophon page +\ifdefined\reviewcolophonpagecont +\reviewcolophonpagecont +\fi + +%%% backcover page +\ifdefined\reviewbackcovercont +\reviewbackcovercont +\fi \end{document} diff --git a/templates/latex/review-jlreq/review-jlreq.cls b/templates/latex/review-jlreq/review-jlreq.cls new file mode 100644 index 000000000..9a8127762 --- /dev/null +++ b/templates/latex/review-jlreq/review-jlreq.cls @@ -0,0 +1,135 @@ +% Re:VIEW + jlreq +% Copyright 2018 Kenshi Muto +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{review-jlreq}[2018/4/28] +\LoadClassWithOptions{jlreq} + +% クラスオプション +% munepiさんのを踏襲しておいたほうがいいかな +% hanmengrid(boolean)→これは今回実装対応しない +% hanmen(boolean)→版面表示。便利なので入れたい +% draft(boolean)→これはjlreqでいける? +% tombo(boolean)→トンボ有効化 (done) +% mentuke(boolean)→これはどうしようかな +% cameraready=pdf/print(string)→設定どうしよう +% paper=a5+3mm→これだとパースをまるまる複製しないとかな…。jlreq-trimmarksのオプションとだいぶ違う +% toc:break-before=right, index:break-before=both あたりは完全白ページが問題になる同人誌だと怖い? +% 白ページでもノンブルを打つ という設定(とpagestyleが必要?) +% 扉画像の指定はreviewmacroのパラメータのほうでやらせるべきかな +% +% <> +% tombo:bleed(数値+単位) : 裁ち落とし幅。デフォルト3mm +% tombo:color(\colorの色またはcmykの組み合わせ) : トンボの色。デフォルトcmyk(全プレート) +% tombo:paper(トンボ入り紙面サイズ) : トンボを付けたときのサイズ。デフォルトは現在のサイズ+2インチ。a4, b5(ここでのbはJISサイズ)などを指定可能。{width, height}も指定可能…だけど今はダメ(FIXME) +% tombo:show({}指定) : {trimmarks,banner,digital}からの組み合わせ。trimmarksはトンボマーク表示、bannerはファイル名+日付、digitalはデジタルトンボ情報を入れる (FIXME、{}がまだとれない) +% hyperrefの設定もやったほうがよさそう + +% FIXME: Unused global option [book] が出るの嫌だなぁ(実際はchapterに必要) +% \setkeyしたら影響が…なんとかなるんかなこれ +\DeclareOption{book}{\OptionNotUsed} +\DeclareOption{dvipdfmx}{\OptionNotUsed} + +% documentclassでのkeyval使用定義 +\DeclareOption*{\rjreq@setkey} +\def\rjreq@setkey{\expandafter\@rjreq@setkey\expandafter{\CurrentOption}} +\def\@rjreq@setkey{\setkeys{rjreq}} + +% トンボ有効化時設定 +\newif\if@review@jlreq@tombo +\@review@jlreq@tombofalse +\DeclareOption{tombo}{\@review@jlreq@tombotrue} +% トンボの詳細設定 +%% パッケージオプション系。初期値は定義しないことにしてundefined評価でオプション追加するかどうかを判定させることに +%\def\@review@jkreq@tombo@paper{a4} +%\def\@review@jkreq@tombo@show{trimmarks,banner,digital} + +%% \jlreqtrimmarkssetup設定系 +\def\@review@jlreq@tombo@banner{\jobname\space(\number\year-\two@digits\month-\two@digits\day\space\two@digits\hour:\two@digits\minute)}% バナー(動的にはできない) +\def\@review@jlreq@tombo@bleed{3mm}% 裁ち落とし幅(ドブ) +\def\@review@jlreq@tombo@color{cmyk}% トンボの色。cmykはCMYK全プレートで100% + +% documentoptionからの取り込み +\define@key{rjreq}{tombo:paper}{\def\@review@jlreq@tombo@paper{#1}} +\define@key{rjreq}{tombo:show}{\def\@review@jlreq@tombo@show{#1}}% FIXME:これは{}を取るのでダメ +\define@key{rjreq}{tombo:banner}{\def\@review@jlreq@tombo@banner{#1}} +\define@key{rjreq}{tombo:bleed}{\def\@review@jlreq@tombo@bleed{#1}} +\define@key{rjreq}{tombo:color}{\def\@review@jlreq@tombo@color{#1}} + +\ExecuteOptions{}% 初期有効化するもの +\ProcessOptions\relax +% パッケージオプションの適用 +\ifdefined\@review@jlreq@tombo@paper + \PassOptionsToPackage{trimmarks_paper=\@review@jlreq@tombo@paper}{jlreq-trimmarks} +\fi +\ifdefined\@review@jlreq@tombo@show% FIXME:これは{}を取るのでダメ + \PassOptionsToPackage{show=\@review@jlreq@tombo@show}{jlreq-trimmarks} +\fi + +%% fixes to LaTeX2e +\RequirePackage{fix-cm,exscale} +\IfFileExists{latexrelease.sty}{}{\RequirePackage{fixltx2e}} +\IfFileExists{platexrelease.sty}{%% is bundled in TL16 or higher release version + +\PassOptionsToPackage{nosetpagesize}{graphicx}%%for TL16 or higher version +}{} + +% トンボ指定 +\if@review@jlreq@tombo +% FIXME:パッケージオプションのtrimmarks_paper, showをどう渡すか +\RequirePackage{jlreq-trimmarks} +\fi + +% エンジンとドライバの情報。jlreq-trimmarksが定義されていればそっちから持ってくる。 +% 定義されていなければjlreqから持ってくる +\def\review@jlreq@engine{} +\def\review@jlreq@driver{} +\ifdefined\jlreq@trimmarks@engine + \ifx l\jlreq@trimmarks@engine\def\review@jlreq@engine{lualatex}\fi + \ifx u\jlreq@trimmarks@engine\def\review@jlreq@engine{uplatex}\fi + \ifx p\jlreq@trimmarks@engine\def\review@jlreq@engine{platex}\fi +\else% jlreqから持ってくる + \ifx l\jlreq@engine\def\review@jlreq@engine{lualatex}\fi + \ifx u\jlreq@engine\def\review@jlreq@engine{uplatex}\fi + \ifx p\jlreq@engine\def\review@jlreq@engine{platex}\fi +\fi +\ifdefined\jlreq@trimmarks@driver + \ifx f\jlreq@trimmarks@driver\def\review@jlreq@driver{dvipdfmx}\fi + \ifx s\jlreq@trimmarks@driver\def\review@jlreq@driver{dvips}\fi + \ifx o\jlreq@trimmarks@driver\def\review@jlreq@driver{dviout}\fi +\else% jlreqから持ってくる + \ifx l\jlreq@engine + \def\review@jlreq@driver{lualatex} + \else + \def\review@jlreq@driver{dvipdfmx} + \fi +\fi + +\RequirePackage[\review@jlreq@driver]{graphicx} +\RequirePackage[\review@jlreq@driver,table]{xcolor} + +% jlreq-trimmarksへ追加オプション渡し(事前にxcolorが必要) +% trimmarks_widthを指定したくなるケースはまずないとしてよいかな…bannerもどうするか +\if@review@jlreq@tombo + \jlreqtrimmarkssetup{bleed_margin=\@review@jlreq@tombo@bleed,color=\@review@jlreq@tombo@color,banner=\@review@jlreq@tombo@banner}% デフォルトは3mm, cmyk +\fi + +\RequirePackage[T1]{fontenc} +\RequirePackage{textcomp}%T1/TS1 +\RequirePackage{lmodern}%\ttdefault: lmtt +% FIXME:documentoptionである程度指定したい +\RequirePackage[\review@jlreq@driver, bookmarks=true, bookmarksnumbered=true, + % colorlinks=true, + hidelinks, +setpagesize=false]{hyperref}[2016/06/24 v6.83q] +\RequirePackage[\review@jlreq@driver]{pxjahyper}[2012/05/27 v0.2] + +\RequirePackage{tikz} +\usetikzlibrary{calc} +\RequirePackage{tcolorbox} +\tcbuselibrary{xparse,hooks,skins,breakable} +\RequirePackage{multirow} +\RequirePackage{amsmath} +\RequirePackage{amssymb} +\RequirePackage{bm} +\RequirePackage{needspace} +\usepackage{upquote,textcomp} diff --git a/templates/latex/review-jlreq/reviewmacro.sty b/templates/latex/review-jlreq/reviewmacro.sty new file mode 100644 index 000000000..717fcf77a --- /dev/null +++ b/templates/latex/review-jlreq/reviewmacro.sty @@ -0,0 +1 @@ +% ユーザー固有の定義 diff --git a/templates/latex/review-jsbook/jumoline.sty b/templates/latex/review-jsbook/jumoline.sty new file mode 100644 index 000000000..b1c5d8d9e --- /dev/null +++ b/templates/latex/review-jsbook/jumoline.sty @@ -0,0 +1,310 @@ +%% +%% This is file `jumoline.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% jumoline.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from jumoline.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file jumoline.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% Style file `jumoline'. +%% Copyright (C) 1999-2001 Hiroshi Nakashima +%% (Toyohashi Univ. of Tech.) +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +%% +\def\next{LaTeX2e} +\ifx\fmtname\next +\def\next{ +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{jumoline}} +\else\def\next[#1]{}\fi +\next +[2001/05/31 v1.2 ] + +\ifx\PackageError\undefined +\def\PackageError#1#2#3{\@latexerr{#1:#2}{#3^^J\@ehc}} +\fi + +%%^L + +%% Register Declaration + +\newdimen\UnderlineDepth \UnderlineDepth-\maxdimen +\newdimen\MidlineHeight \MidlineHeight-\maxdimen +\newdimen\OverlineHeight \OverlineHeight-\maxdimen +\newdimen\UMOlineThickness \UMOlineThickness.4pt + +\newdimen\UMO@height \newdimen\UMO@depth +\newdimen\UMO@dqspace \newdimen\UMO@tempdim + +\newskip\UMO@prejfmglue \newskip\UMO@postjfmglue + +\newcount\UMO@mode +\let\UMO@afterblock\z@ +\let\UMO@afterword\@ne +\let\UMO@afterchar\tw@ + +\newcount\UMO@spacefactor +\newcount\UMO@firstxspcode +\newcount\UMO@lastxspcode +\newcount\UMO@inhibitxspcode +\newcount\UMO@prebreakpenalty +\newcount\UMO@postbreakpenalty +\newcount\UMO@kpostbreakpenalty + +\newif\ifUMO@nospace \newif\ifUMO@firstelem + +%%^L + +%% User Interface and Initialization + +\def\Underline{\UMO@line\UnderlineDepth{-\UnderlineDepth}{-\dp\strutbox}} +\def\Midline{\setbox\@tempboxa\hbox{あ}% + \UMO@line\MidlineHeight\MidlineHeight{.5\ht\@tempboxa}} +\def\Overline{\UMO@line\OverlineHeight\OverlineHeight{\ht\strutbox}} +\def\UMOline{\UMO@line{-\maxdimen}\z@} + +\def\UMO@line#1#2#3#4{\begingroup \let\\\UMOnewline + \relax\ifdim#1<\z@ \UMO@height#3\relax + \else \UMO@height#2\relax \fi + \UMO@depth-\UMO@height + \ifdim\UMO@height<\z@ \advance\UMO@depth\UMOlineThickness + \else \advance\UMO@height\UMOlineThickness \fi + \settowidth\UMO@dqspace{“}\advance\UMO@dqspace-1zw + \UMO@dqspace-\UMO@dqspace \divide\UMO@dqspace\tw@ + \UMO@nospacetrue \UMO@firstelemtrue + \UMO@mode\UMO@afterblock + \ifvmode\leavevmode\fi + \def\@tempa{#4 }\edef\@tempb{\noexpand\@nil\space}% + \expandafter\expandafter\expandafter\UMO@wordloop + \expandafter\@tempa\@tempb + \endgroup \UMO@aftergroup} + +%%^L + +%% Processing Word Elements + +\def\UMO@wordloop{\UMO@ifbgroup\UMO@wordblock\UMO@iwordloop} +\def\UMO@ifbgroup#1#2{\let\@tempa#1\let\@tempb#2\futurelet\@tempc\UMO@ifnc} +\def\UMO@ifnc{\ifx\@tempc\bgroup \let\next\@tempa \else\let\next\@tempb \fi + \next} +\def\UMO@wordblock#1{\UMO@spaceskip + \UMO@putbox\relax{#1}\UMO@nospacetrue \UMO@mode\UMO@afterblock + \UMO@spacefactor\@m \UMO@wordloop} +\def\UMO@iwordloop#1 {\def\@tempa{#1}\ifx\@tempa\@nnil \let\next\UMO@end + \else + \ifx\@tempa\empty \UMO@nospacefalse + \else + \UMO@spaceskip \UMO@mode\UMO@afterblock + \def\UMO@theword{}\UMO@firstxspcode\m@ne + \UMO@charloop#1\@nil \fi + \let\next\UMO@wordloop \fi + \next} + +%%^L + +%% Interword Spacing + +\def\UMO@spaceskip{\ifUMO@nospace \UMO@nospacefalse \else + \ifdim\spaceskip=\z@ + \@tempdima\fontdimen3\font\relax + \multiply\@tempdima\UMO@spacefactor \divide\@tempdima\@m + \@tempdimb\fontdimen4\font\relax \multiply\@tempdimb\@m + \divide\@tempdimb\UMO@spacefactor + \@tempskipa\fontdimen2\font plus\@tempdima minus\@tempdimb\relax + \else + \edef\@tempa{\the\spaceskip\space @ @ @ @ }% + \expandafter\UMO@setspaceskip\@tempa\@nil + \fi + \ifnum\UMO@spacefactor<2000\else + \ifdim\xspaceskip=\z@ \advance\@tempskipa\fontdimen7\font + \else \@tempskipa\xspaceskip + \fi\fi + \UMO@skip\@tempskipa \fi} +\def\UMO@setspaceskip#1 #2 #3 #4 #5 #6\@nil{\@tempdima\z@ \@tempdimb\z@ + \def\@tempa{#2}\def\@tempb{#3}% + \ifx\@tempa\UMO@plus \@tempdima#3\def\@tempa{#4}\def\@tempb{#5}\fi + \ifx\@tempa\UMO@minus \@tempdimb\@tempb\relax\fi + \multiply\@tempdima\UMO@specefactor \divide\@tempdima\@m + \multiply\@tempdimb\@m \divide\UMO@spacefactor + \@tempskipa#1 plus\@tempdima minus\@tempdimb\relax} +\def\@tempa#1 #2 #3 #4 #5\@nil{\def\UMO@plus{#2}\def\UMO@minus{#4}} +\@tempskipa1pt plus 2pt minus 3pt +\expandafter\@tempa\the\@tempskipa\@nil + +%%^L + +%% Processing Characters + +\def\UMO@charloop{\UMO@ifbgroup\UMO@charblock\UMO@icharloop} +\def\UMO@charblock#1{\UMO@putword + \UMO@putbox\relax{#1}\UMO@mode\UMO@afterblock \UMO@spacefactor\@m + \UMO@charloop} +\def\UMO@icharloop#1{\def\@tempa{#1}% + \ifx\@tempa\@nnil \UMO@putword \let\next\relax + \else\ifx\UMOspace#1\relax \UMO@putword \let\next\UMO@space + \else\ifx\UMOnewline#1\relax \UMO@putword \let\next\UMO@newline + \else + \ifnum`#1<256\relax \edef\UMO@theword{\UMO@theword#1}% + \ifnum\UMO@firstxspcode<\z@ + \UMO@firstxspcode\xspcode`#1\relax + \UMO@prebreakpenalty\prebreakpenalty`#1\relax + \fi + \UMO@lastxspcode\xspcode`#1\relax + \UMO@postbreakpenalty\postbreakpenalty`#1\relax + \else \UMO@putword \UMO@putchar{#1}\UMO@spacefactor\@m\fi + \let\next\UMO@charloop \fi\fi\fi \next} +\def\UMOspace{\PackageError{jumoline}% + {\string\UMOspace\space cannot be used here.}% + {\string\UMOspace\space can be used only in the argument of + \string\Underline\space and its relatives.}} +\def\UMOnewline{\PackageError{jumoline}% + {\string\UMOnewline\space cannot be used here.}% + {\string\UMOnewline\space can be used only in the argument of + \string\Underline\space and its relatives.}} + +%%^L + +%% Put ASCII String + +\def\UMO@putword{\ifx\UMO@theword\empty\else + \ifnum\UMO@mode=\UMO@afterchar + \advance\UMO@kpostbreakpenalty\UMO@prebreakpenalty + \penalty\UMO@kpostbreakpenalty + \ifdim\UMO@postjfmglue>\z@ \UMO@skip\UMO@postjfmglue + \else\ifodd\UMO@inhibitxspcode \ifodd\UMO@firstxspcode + \UMO@skip\xkanjiskip \fi\fi\fi\fi + \setbox\@tempboxa\hbox{% + \UMO@theword\global\UMO@spacefactor\spacefactor}% + \UMO@putbox\relax\UMO@theword \UMO@mode\UMO@afterword + \def\UMO@theword{}\fi \UMO@firstxspcode\m@ne} + +%%^L + +%% Put Kanji Letter + +\def\UMO@putchar#1{% + \ifnum\UMO@mode=\UMO@afterchar \UMO@prejfmglue\UMO@postjfmglue + \else \UMO@prejfmglue\z@ \fi + \UMO@postjfmglue\z@ + \ifnum`#1<\kuten"1001\relax\UMO@setjfmglue{#1}\fi + \@tempskipa\UMO@prejfmglue + \UMO@inhibitxspcode\inhibitxspcode`#1\relax + \@tempcnta\prebreakpenalty`#1\relax + \ifnum\UMO@mode=\UMO@afterchar + \advance\@tempcnta\UMO@kpostbreakpenalty + \ifdim\UMO@prejfmglue=\z@ \@tempskipa\kanjiskip \fi + \else\ifnum\UMO@mode=\UMO@afterword + \advance\@tempcnta\UMO@postbreakpenalty + \ifdim\UMO@prejfmglue=\z@ + \ifnum\UMO@lastxspcode>\@ne \ifnum\UMO@inhibitxspcode>\@ne + \@tempskipa\xkanjiskip \fi\fi\fi\fi\fi + \penalty\@tempcnta + \edef\@tempa{\the\@tempskipa}\ifx\@tempa\UMO@zskip\else + \UMO@skip\@tempskipa \fi + \UMO@putbox\inhibitglue{#1}% + \UMO@kpostbreakpenalty\postbreakpenalty`#1\relax + \UMO@mode\UMO@afterchar} +\@tempskipa\z@ +\edef\UMO@zskip{\the\@tempskipa} +\def\UMO@setjfmglue#1{% + \settowidth\@tempdima{あ#1}\settowidth\@tempdimb{あ\inhibitglue#1}% + \advance\@tempdima-\@tempdimb + \settowidth\UMO@tempdim{#1あ}\settowidth\@tempdimb{#1\inhibitglue あ}% + \advance\UMO@tempdim-\@tempdimb + \ifdim\@tempdima>\z@ + \ifdim\UMO@tempdim>\z@ + \@tempskipa\@tempdima minus\@tempdima\relax + \UMO@postjfmglue\UMO@tempdim minus\UMO@tempdim\relax + \else \@tempskipa\@tempdima minus\UMO@dqspace\relax \fi + \advance\UMO@prejfmglue\@tempskipa + \else \UMO@postjfmglue\UMO@tempdim minus\UMO@dqspace \fi} + +%%^L + +%% Draw Under/Mid/Overline + +\def\UMO@putbox#1#2{\setbox\@tempboxa\hbox{#1#2#1}\@tempdima\wd\@tempboxa + \ifUMO@firstelem\else + \rlap{\vrule\@height\UMO@height\@depth\UMO@depth\@width\@tempdima}\fi + \box\@tempboxa + \ifUMO@firstelem \UMO@firstelemfalse + \llap{\vrule\@height\UMO@height\@depth\UMO@depth\@width\@tempdima}\fi} +\def\UMO@skip#1{% + \leaders\hrule\@height\UMO@height\@depth\UMO@depth\hskip#1\relax} + +%%^L + +%% Explicit Spacing and Line Breaking + +\def\UMO@space{\UMO@mode\UMO@afterblock + \@ifstar\UMO@sspace\UMO@ispace} +\def\UMO@sspace#1{\vrule width\z@\nobreak\UMO@skip{#1}\UMO@charloop} +\def\UMO@ispace#1{\@tempskipa#1\relax + \@ifstar{\@tempswafalse\UMO@iispace}{\@tempswatrue\UMO@iispace}} +\def\UMO@iispace{\@ifnextchar[%] + {\UMO@penalty}% + {\UMO@skip\@tempskipa \UMO@charloop}} +\def\UMO@penalty[#1]{\@tempcnta#1\relax + \if@tempswa + \ifnum\@tempcnta<\z@ \@tempcnta-\@tempcnta \fi + \ifcase\@tempcnta \or + \@tempcnta\@lowpenalty \or + \@tempcnta\@medpenalty \or + \@tempcnta\@highpenalty \else + \@tempcnta\@M \fi + \ifnum#1<\z@ \@tempcnta-\@tempcnta \fi \fi + \penalty\@tempcnta \UMO@skip\@tempskipa \UMO@charloop} + +\def\UMO@newline{\UMO@mode\UMO@afterblock + \@ifstar{\UMO@skip{0pt plus1fil}\break \UMO@charloop}% + {\hfil \break \UMO@charloop}} + +%%^L + +%% Finalization + +\def\UMO@end{\ifnum\UMO@mode=\UMO@afterchar + \ifnum\UMO@kpostbreakpenalty>\z@ + \penalty\UMO@kpostbreakpenalty \fi + \ifdim\UMO@postjfmglue>\z@ + \UMO@skip\UMO@postjfmglue\fi \fi + \xdef\UMO@aftergroup{\ifnum\UMO@mode=\UMO@afterword + \spacefactor\number\UMO@spacefactor\fi}} +\endinput +%% +%% End of file `jumoline.sty'. diff --git a/templates/latex/review-jsbook/review-basemacros.sty b/templates/latex/review-jsbook/review-basemacros.sty new file mode 100644 index 000000000..b491fb29f --- /dev/null +++ b/templates/latex/review-jsbook/review-basemacros.sty @@ -0,0 +1,361 @@ +\usepackage{ifthen} +\ifthenelse{\equal{\review@texcompiler}{uplatex}}{% +\usepackage[deluxe,uplatex]{otf}% +}{% +\usepackage[deluxe]{otf}% +} +\usepackage{caption} +\usepackage{suffix} +\usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1 +\usepackage{lmodern} +\usepackage[dvipdfmx]{graphicx} +\usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array +\usepackage{framed} +\usepackage{wrapfig} +\definecolor{shadecolor}{gray}{0.9} +\definecolor{shadecolorb}{gray}{0.1} +\definecolor{reviewgreen}{rgb}{0,0.4,0} +\definecolor{reviewblue}{rgb}{0.2,0.2,0.4} +\definecolor{reviewred}{rgb}{0.7,0,0} +\definecolor{reviewdarkred}{rgb}{0.3,0,0} +\usepackage[utf8]{inputenc} +\usepackage{ascmac} +\usepackage{float} +\usepackage{alltt} +\usepackage{amsmath} + +%% if you use @{} (underline), use jumoline.sty +\IfFileExists{jumoline.sty}{ +\usepackage{jumoline} +} + +\newenvironment{shadedb}{% + \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolorb}}% + \MakeFramed {\FrameRestore}}% + {\endMakeFramed} + +\ifthenelse{\equal{\review@documentclass}{utbook} \OR \equal{\review@documentclass}{tbook}}{% +}{% +\usepackage[top=10zw,bottom=12zw,left=10zw,right=10zw]{geometry}% +} + +\newcommand{\parasep}{\vspace*{3zh}} +\setlength{\footskip}{30pt} + +\usepackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true,colorlinks=true,% + pdftitle={\review@booktitle_name},% + pdfauthor={\review@aut_names}]{hyperref} +\usepackage[dvipdfmx]{pxjahyper} + +\ifthenelse{\equal{\review@documentclass}{utbook} \OR \equal{\review@documentclass}{tbook}}{% +\newcommand{\headfont}{\gtfamily\sffamily\bfseries} +\usepackage{plext} +}{% +} + +\ifdefined\review@highlight_latex + \ifthenelse{\equal{\review@highlight_latex}{listings}}{% + \ifhtneelse{\equal{\review@language}{ja}}{% + \usepackage{listings,jlisting} + }{% + \usepackage{listings} + }% + \renewcommand{\lstlistingname}{\review@intn@list} + \lstset{% + breaklines=true,% + breakautoindent=false,% + breakindent=0pt,% + fontadjust=true,% + backgroundcolor=\color{shadecolor},% + frame=single,% + framerule=0pt,% + basicstyle=\ttfamily\scriptsize,% + commentstyle=\color{reviewgreen},% + identifierstyle=\color{reviewblue},% + stringstyle=\color{reviewred},% + keywordstyle=\bfseries\color{reviewdarkred},% + } + \lstnewenvironment{reviewemlistlst}[1][]{\lstset{#1}}{} + \lstnewenvironment{reviewemlistnumlst}[1][]{\lstset{numbers=left, #1}}{} + \lstnewenvironment{reviewlistlst}[1][]{\lstset{#1}}{} + \lstnewenvironment{reviewlistnumlst}[1][]{\lstset{numbers=left, #1}}{} + \lstnewenvironment{reviewsourcelst}[1][]{\lstset{#1}}{} + \lstnewenvironment{reviewsourcenumlst}[1][]{\lstset{numbers=left, #1}}{} + \lstnewenvironment{reviewcmdlst}[1][]{\lstset{backgroundcolor=\color{white}, frameround=tttt, frame=trbl, #1}}{} + }{% + } +\fi + +\newenvironment{reviewimage}{% + \begin{figure}[H] + \begin{center}}{% + \end{center} + \end{figure}} + +\newenvironment{reviewdummyimage}{% + \begin{figure}[H] + \begin{center}\begin{alltt}}{% + \end{alltt}\end{center} + \end{figure}} + +\newenvironment{reviewemlist}{% + \medskip\small\begin{shaded}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}} + +\newenvironment{reviewlist}{% + \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}\par\vspace*{0.5zw}} + +\newenvironment{reviewsource}{% + \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shaded}\par\vspace*{0.5zw}} + +\newenvironment{reviewcmd}{% + \color{white}\medskip\small\begin{shadedb}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{shadedb}} + +\newenvironment{reviewbox}{% + \medskip\small\begin{framed}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% + \end{alltt}\end{framed}} + +\newenvironment{reviewtable}[1]{% + \begin{center}\small\setlength{\baselineskip}{1.2zw} + \begin{tabular}{#1}}{% + \end{tabular} + \end{center}} + +\newenvironment{reviewcolumn}{% + \begin{framed} + }{% + \end{framed} + \vspace{2zw}} + +\newcommand{\reviewcolumnhead}[2]{% +{\noindent\large \review@intn@column_head{}: #2}} + +\newcommand{\reviewtablecaption}[1]{% + \caption{#1}} + +\WithSuffix\newcommand\reviewtablecaption*[1]{% + \caption*{#1}} + +\newcommand{\reviewimgtablecaption}[1]{% + \caption{#1}\vspace{-3mm}} + +\newcommand{\reviewbackslash}[0]{% + \textbackslash{}} + +\newcommand{\reviewlistcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewemlistcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewsourcecaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewcmdcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewindepimagecaption}[1]{% + \begin{center}#1\end{center}} + +\newcommand{\reviewboxcaption}[1]{% + \medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\newcommand{\reviewimageref}[2]{\review@intn@image #1} +\newcommand{\reviewtableref}[2]{\review@intn@table #1} +\newcommand{\reviewlistref}[1]{\review@intn@list #1} +\newcommand{\reviewbibref}[2]{#1} +\newcommand{\reviewcolumnref}[2]{\review@intn@columnname #1} +\newcommand{\reviewsecref}[2]{#1} + +\newcommand{\reviewminicolumntitle}[1]{% + {\large \review@intn@memo_head{}: #1}\\} + +\renewcommand{\contentsname}{\review@toctitle} + +\newenvironment{reviewminicolumn}{% + \vspace{1.5zw}\begin{screen}}{% + \end{screen}\vspace{2zw}} + +\newcommand{\reviewkw}[1]{\textbf{\textgt{#1}}} +\newcommand{\reviewami}[1]{\mask{#1}{A}} +\newcommand{\reviewem}[1]{\textbf{#1}} +\newcommand{\reviewstrong}[1]{\textbf{#1}} +\newcommand{\reviewunderline}[1]{\Underline{#1}} +\newcommand{\reviewit}[1]{\textit{#1}} +\newcommand{\reviewbold}[1]{\textbf{#1}} +\newcommand{\reviewcode}[1]{\texttt{#1}} +\newcommand{\reviewtt}[1]{\texttt{#1}} +\newcommand{\reviewtti}[1]{\texttt{\textit{#1}}} +\newcommand{\reviewttb}[1]{\texttt{\textbf{#1}}} + +%% @ is ignored in LaTeX with default style +\newcommand{\reviewstrike}[1]{#1} + +%%%% for ulem.sty: +%%\renewcommand{\reviewstrike}[1]{\sout{#1}} +%% +%%%% for jumoline.sty: +%%\renewcommand{\reviewstrike}[1]{\Middleline{#1}} + +\newcommand{\reviewth}[1]{\textgt{#1}} +\newcommand{\reviewtitlefont}[0]{\usefont{T1}{phv}{b}{n}\gtfamily} +\newcommand{\reviewmainfont}[0]{} +\newcommand{\reviewcolophon}[0]{\clearpage} +\newcommand{\reviewappendix}[0]{\appendix} + +\newcommand{\reviewprepartname}{\review@prepartname} +\newcommand{\reviewpostpartname}{\review@postpartname} +\newcommand{\reviewprechaptername}{\review@prechaptername} +\newcommand{\reviewpostchaptername}{\review@postchaptername} +\newcommand{\reviewfigurename}{\review@figurename} +\newcommand{\reviewtablename}{\review@tablename} +\newcommand{\reviewappendixname}{\review@appendixname} + +\ifdefined\prepartname + \renewcommand{\prepartname}{\reviewprepartname} +\fi +\ifdefined\postpartname + \renewcommand{\postpartname}{\reviewpostpartname} +\fi +\ifdefined\prechaptername + \renewcommand{\prechaptername}{\reviewprechaptername} +\fi +\ifdefined\postchaptername + \renewcommand{\postchaptername}{\reviewpostchaptername} +\fi +\ifdefined\figurename + \renewcommand{\figurename}{\reviewfigurename} +\fi +\ifdefined\tablename + \renewcommand{\tablename}{\reviewtablename} +\fi +\ifdefined\appendixname + \renewcommand{\appendixname}{\reviewappendixname} +\fi + +%% maxwidth is the original width if it is less than linewidth +%% otherwise use linewidth (to make sure the graphics do not exceed the margin) +\def\maxwidth{% + \ifdim\Gin@nat@width>\linewidth + \linewidth + \else + \Gin@nat@width + \fi +} + +% hooks +\def\reviewfrontmatterhook{% + \renewcommand{\chaptermark}[1]{{}} + \frontmatter +} + +\def\reviewmainmatterhook{% + \renewcommand{\chaptermark}[1]{\markboth{\prechaptername\thechapter\postchaptername~##1}{}} + \mainmatter +} + +\def\reviewappendixhook{% + \renewcommand{\chaptermark}[1]{\markboth{\appendixname\thechapter~##1}{}} + \reviewappendix +} + +\def\reviewbackmatterhook{% + \backmatter +} + +% cover +\ifdefined\review@cover + \def\reviewcoverpagecont{\review@coverfile} +\fi +\ifdefined\review@coverimage + \def\reviewcoverpagecont{% +\thispagestyle{empty} +\begin{center} +\expandafter\includegraphics\expandafter[\review@coverimageoption]{\review@coverimage}% includefullpagegraphicsを導入すべき? +\end{center} +\clearpage + } +\fi + +% titlepage +\ifdefined\review@titlepage + \ifthenelse{\isundefined{\review@titlefile}}{% + \def\reviewtitlepagecont{% + \begin{titlepage} + \thispagestyle{empty} + \begin{center}% + \mbox{} \vskip5zw + \reviewtitlefont% + {\Huge\review@booktitle_name\par}% + \ifdefined\review@subtitle_name + \vskip 1em% + {\Large\review@subtitle_name\par}% + \fi + \vskip 15em% + {\huge + \lineskip .75em + \begin{tabular}[t]{c}% + \review@titlepageauthors + \end{tabular}\par}% + \vfill + {\large\review@date \review@intn@edition\hspace{2zw}\review@intn@published_by\par}% + \vskip4zw\mbox{} + \end{center}% + \end{titlepage}\clearpage + } + }{% + \def\reviewtitlepagecont{\review@titlefile} + } +\fi + +% toc +\ifdefined\review@toc + \def\reviewtableofcontents{% +\setcounter{tocdepth}{\review@tocdepth} +\tableofcontents +} +\fi + +% index +\ifdefined\review@makeindex + \usepackage{makeidx} + \makeindex +\fi + +\ifdefined\review@makeindex + \def\reviewprintindex{% +\printindex +} +\fi + +% colophon +\ifdefined\review@colophon + \ifthenelse{\isundefined{\review@colophonfile}}{% + \def\reviewcolophonpagecont{% +\reviewcolophon +\thispagestyle{empty} +\vspace*{\fill} +\typeout{\review@booktitle_name} +{\noindent\reviewtitlefont\Large\review@booktitle_name}\\ +\ifdefined\review@subtitle_name +{\noindent\reviewtitlefont\large\review@subtitle_name} \\ +\fi +\rule[8pt]{\textwidth}{1pt} \\ +{\noindent\review@pubhistories} + +\begin{tabular}{ll} +\review@colophon_names +\end{tabular} + \\ +\rule[0pt]{\textwidth}{1pt} \\ +\ifdefined\review@rights +\review@rights +\fi + }% + }{% + \def\reviewcolophonpagecont{\review@colophonfile} + } +\fi diff --git a/templates/latex/review-jsbook/review-reviewmacro.sty b/templates/latex/review-jsbook/review-reviewmacro.sty new file mode 100644 index 000000000..64ba4ed17 --- /dev/null +++ b/templates/latex/review-jsbook/review-reviewmacro.sty @@ -0,0 +1,38 @@ +\usepackage{fancyhdr} +\pagestyle{fancy} +\lhead{\gtfamily\sffamily\bfseries\upshape \leftmark} +\chead{} +\rhead{\gtfamily\sffamily\bfseries\upshape \rightmark} +\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}{}} +\renewcommand{\chaptermark}[1]{\markboth{\prechaptername\ \thechapter\ \postchaptername~#1}{}} +\renewcommand{\headfont}{\gtfamily\sffamily\bfseries} + +\fancypagestyle{plainhead}{% +\fancyhead{} +\fancyfoot{} % clear all header and footer fields +\fancyfoot[CE,CO]{\thepage} +\renewcommand{\headrulewidth}{0pt} +\renewcommand{\footrulewidth}{0pt}} + +%% using Helvetica as sans-serif +\renewcommand{\sfdefault}{phv} + +%% for listings +%\renewcommand{\lstlistingname}{List} +%\lstset{% +% breaklines=true,% +% breakautoindent=false,% +% breakindent=0pt,% +% fontadjust=true,% +% backgroundcolor=\color{shadecolor},% +% frame=single,% +% framerule=0pt,% +% basicstyle=\ttfamily\scriptsize,% +% commentstyle=\color{reviewgreen},% +% identifierstyle=\color{reviewblue},% +% stringstyle=\color{reviewred},% +% keywordstyle=\bfseries\color{reviewdarkred},% +%} + +%% disable hyperlink color and border +\hypersetup{hidelinks} diff --git a/templates/latex/review-jsbook/reviewmacro.sty b/templates/latex/review-jsbook/reviewmacro.sty new file mode 100644 index 000000000..f44f485ae --- /dev/null +++ b/templates/latex/review-jsbook/reviewmacro.sty @@ -0,0 +1,7 @@ +% Re:VIEW 2互換のlayout.tex.erb記載相当の内容 +\usepackage{review-basemacros} + +% Re:VIEW 2互換のreviewmacro.sty(装飾カスタマイズ)内容 +\usepackage{review-reviewmacro} + +% ユーザー固有の定義 diff --git a/test/assets/test_template.tex b/test/assets/test_template.tex index 185dfd2e9..fa2f42f87 100644 --- a/test/assets/test_template.tex +++ b/test/assets/test_template.tex @@ -1,262 +1,131 @@ \documentclass[dvipdfmx,uplatex,oneside]{jsbook} -% %% fixes to LaTeX2e -% \usepackage{fix-cm}[2006/09/13 v1.1m] -% \usepackage{fixltx2e}[2006/09/13 v1.1m] - -\usepackage[deluxe,uplatex]{otf} -\usepackage{caption} -\usepackage{suffix} -\usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1 -\usepackage{lmodern} -\usepackage[dvipdfmx]{graphicx} -\usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array -\usepackage{framed} -\usepackage{wrapfig} -\definecolor{shadecolor}{gray}{0.9} -\definecolor{shadecolorb}{gray}{0.1} -\definecolor{reviewgreen}{rgb}{0,0.4,0} -\definecolor{reviewblue}{rgb}{0.2,0.2,0.4} -\definecolor{reviewred}{rgb}{0.7,0,0} -\definecolor{reviewdarkred}{rgb}{0.3,0,0} -\usepackage[utf8]{inputenc} -\usepackage{ascmac} -\usepackage{float} -\usepackage{alltt} -\usepackage{amsmath} - -%% if you use @{} (underline), use jumoline.sty -\IfFileExists{jumoline.sty}{ -\usepackage{jumoline} -} - -\newenvironment{shadedb}{% - \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolorb}}% - \MakeFramed {\FrameRestore}}% - {\endMakeFramed} - -\usepackage[top=10zw,bottom=12zw,left=10zw,right=10zw]{geometry} -%\usepackage[top=5zw,bottom=5zw,left=1zw,right=1zw]{geometry} - -\newcommand{\parasep}{\vspace*{3zh}} -\setlength{\footskip}{30pt} - -%% Bookmarkの文字化け対策(日本語向け) -\usepackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true,colorlinks=true,% - pdftitle={Re:VIEW Sample Book},% - pdfauthor={}]{hyperref} -\usepackage[dvipdfmx]{pxjahyper} - - - -\newenvironment{reviewimage}{% - \begin{figure}[H] - \begin{center}}{% - \end{center} - \end{figure}} - -\newenvironment{reviewdummyimage}{% - \begin{figure}[H] - \begin{center}\begin{alltt}}{% - \end{alltt}\end{center} - \end{figure}} - -\newenvironment{reviewemlist}{% - \medskip\small\begin{shaded}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}} - -\newenvironment{reviewlist}{% - \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}\par\vspace*{0.5zw}} - -\newenvironment{reviewsource}{% - \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shaded}\par\vspace*{0.5zw}} - -\newenvironment{reviewcmd}{% - \color{white}\medskip\small\begin{shadedb}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{shadedb}} - -\newenvironment{reviewbox}{% - \medskip\small\begin{framed}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{% - \end{alltt}\end{framed}} - -\newenvironment{reviewtable}[1]{% - \begin{center}\small\setlength{\baselineskip}{1.2zw} - \begin{tabular}{#1}}{% - \end{tabular} - \end{center}} - -\newenvironment{reviewcolumn}{% - \begin{framed} - }{% - \end{framed} - \vspace{2zw}} - -\newcommand{\reviewcolumnhead}[2]{% -{\noindent\large ■コラム: #2}} - -\newcommand{\reviewtablecaption}[1]{% - \caption{#1}} - -\WithSuffix\newcommand\reviewtablecaption*[1]{% - \caption*{#1}} - -\newcommand{\reviewimgtablecaption}[1]{% - \caption{#1}\vspace{-3mm}} - -\newcommand{\reviewbackslash}[0]{% - \textbackslash{}} - -\newcommand{\reviewlistcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewemlistcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewsourcecaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewcmdcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewindepimagecaption}[1]{% - \begin{center}#1\end{center}} - -\newcommand{\reviewboxcaption}[1]{% - \medskip{\small\noindent #1}\vspace*{-1.3zw}} - -\newcommand{\reviewimageref}[2]{図 #1} -\newcommand{\reviewtableref}[2]{表 #1} -\newcommand{\reviewlistref}[1]{リスト #1} -\newcommand{\reviewbibref}[2]{#1} -\newcommand{\reviewcolumnref}[2]{コラム #1} -\newcommand{\reviewsecref}[2]{#1} - -\newcommand{\reviewminicolumntitle}[1]{% - {\large ■メモ: #1}\\} - -\renewcommand{\contentsname}{目次} - -\newenvironment{reviewminicolumn}{% - \vspace{1.5zw}\begin{screen}}{% - \end{screen}\vspace{2zw}} - -\newcommand{\reviewkw}[1]{\textbf{\textgt{#1}}} -\newcommand{\reviewami}[1]{\mask{#1}{A}} -\newcommand{\reviewem}[1]{\textbf{#1}} -\newcommand{\reviewstrong}[1]{\textbf{#1}} -\newcommand{\reviewunderline}{\Underline} - -%% @ is ignored in LaTeX with default style -\newcommand{\reviewstrike}[1]{#1} - -%%%% for ulem.sty: -%%\renewcommand{\reviewstrike}[1]{\sout{#1}} -%% -%%%% for jumoline.sty: -%%\renewcommand{\reviewstrike}[1]{\Middleline{#1}} - -\newcommand{\reviewth}[1]{\textgt{#1}} -\newcommand{\reviewtitlefont}[0]{\usefont{T1}{phv}{b}{n}\gtfamily} -\newcommand{\reviewmainfont}[0]{} -\newcommand{\reviewcolophon}[0]{\clearpage} -\newcommand{\reviewappendix}[0]{\appendix} - -\newcommand{\reviewprepartname}{第} -\newcommand{\reviewpostpartname}{部} -\newcommand{\reviewprechaptername}{第} -\newcommand{\reviewpostchaptername}{章} -\newcommand{\reviewfigurename}{図} -\newcommand{\reviewtablename}{表} -\newcommand{\reviewappendixname}{付録} - -\ifdefined\prepartname - \renewcommand{\prepartname}{\reviewprepartname} -\fi -\ifdefined\postpartname - \renewcommand{\postpartname}{\reviewpostpartname} -\fi -\ifdefined\prechaptername - \renewcommand{\prechaptername}{\reviewprechaptername} -\fi -\ifdefined\postchaptername - \renewcommand{\postchaptername}{\reviewpostchaptername} -\fi -\ifdefined\figurename - \renewcommand{\figurename}{\reviewfigurename} -\fi -\ifdefined\tablename - \renewcommand{\tablename}{\reviewtablename} -\fi -\ifdefined\appendixname - \renewcommand{\appendixname}{\reviewappendixname} -\fi - - \makeatletter -%% maxwidth is the original width if it is less than linewidth -%% otherwise use linewidth (to make sure the graphics do not exceed the margin) -\def\maxwidth{% - \ifdim\Gin@nat@width>\linewidth - \linewidth - \else - \Gin@nat@width - \fi -} +\def\review@texcompiler{uplatex} +\def\review@documentclass{jsbook} +\def\review@booktitle_name{Re:VIEW Sample Book} +\def\review@aut_names{} +\def\review@titlepageauthors{} +\def\review@date{2011{-}01{-}01} +\def\review@language{ja} +\def\review@intn@list{リスト} +\def\review@intn@column_head{■コラム} +\def\review@intn@image{図} +\def\review@intn@table{表} +\def\review@intn@columnname{コラム} +\def\review@intn@memo_head{■メモ} +\def\review@intn@edition{版} +\def\review@intn@published_by{ 発行} +\def\review@toctitle{目次} +\def\review@prepartname{第} +\def\review@postpartname{部} +\def\review@prechaptername{第} +\def\review@postchaptername{章} +\def\review@figurename{図} +\def\review@tablename{表} +\def\review@appendixname{付録} +\def\review@titlepage{true} + +\def\review@pubhistories{2011年1月1日 発行} +\def\review@colophon_names{} + +\def\reviewprefacefiles{} +\def\reviewchapterfiles{} +\def\reviewappendixfiles{} +\def\reviewpostdeffiles{} + \makeatother \begin{document} -\reviewmainfont +%% coverpage +\ifdefined\reviewcoverpagecont +\reviewcoverpagecont +\fi -\begin{titlepage} -\thispagestyle{empty} -\begin{center}% - \mbox{} \vskip5zw - \reviewtitlefont% - {\Huge Re:VIEW Sample Book \par}% - \vskip 15em% - {\huge - \lineskip .75em - \begin{tabular}[t]{c}% - - \end{tabular}\par}% - \vfill - {\large 2011{-}01{-}01 版\hspace{2zw} 発行\par}% -\vskip4zw\mbox{} - \end{center}% -\end{titlepage} +%% title page +\ifdefined\reviewtitlepagecont +\reviewtitlepagecont +\fi -\renewcommand{\chaptermark}[1]{{}} -\frontmatter +%% frontmatter hook +\ifdefined\reviewfrontmatterhook +\reviewfrontmatterhook +\fi -%%% originaltitle +%% originaltitle +\ifdefined\revieworiginaltitlepagecont +\revieworiginaltitlepagecont +\fi -%%% credit +%% credit +\ifdefined\reviewcreditfilecont +\reviewcreditfilecont +\fi %% preface +\ifdefined\reviewprefacefiles +\reviewprefacefiles +\fi +%% toc +\ifdefined\reviewtableofcontents +\reviewtableofcontents +\fi +%% mainmatter hook +\ifdefined\reviewmainmatterhook +\reviewmainmatterhook +\fi -\renewcommand{\chaptermark}[1]{\markboth{\prechaptername\thechapter\postchaptername~#1}{}} -\mainmatter +%% chapters body +\ifdefined\reviewchapterfiles +\reviewchapterfiles +\fi -\renewcommand{\chaptermark}[1]{\markboth{\appendixname\thechapter~#1}{}} -\reviewappendix +%% appendix hook +\ifdefined\reviewappendixhook +\reviewappendixhook +\fi +%% appendix body +\ifdefined\reviewappendixfiles +\reviewappendixfiles +\fi -%% backmatter begins -\backmatter +%% backmatter hook +\ifdefined\reviewbackmatterhook +\reviewbackmatterhook +\fi +%% postdef body +\ifdefined\reviewpostdeffiles +\reviewpostdeffiles +\fi +%% index page +\ifdefined\reviewprintindex +\reviewprintindex +\fi -%%% profile +%% profile page +\ifdefined\reviewprofilepagecont +\reviewprofilepagecont +\fi -%%% advfile +%% advfile page +\ifdefined\reviewadvfilepagecont +\reviewadvfilepagecont +\fi -%%% colophon +%%% colophon page +\ifdefined\reviewcolophonpagecont +\reviewcolophonpagecont +\fi -%%% backcover +%%% backcover page +\ifdefined\reviewbackcovercont +\reviewbackcovercont +\fi \end{document} diff --git a/test/assets/test_template_backmatter.tex b/test/assets/test_template_backmatter.tex index bc3a431e0..e04391f4b 100644 --- a/test/assets/test_template_backmatter.tex +++ b/test/assets/test_template_backmatter.tex @@ -1,24 +1,142 @@ -\backmatter +\documentclass[dvipdfmx,uplatex,oneside]{jsbook} +\makeatletter +\def\review@texcompiler{uplatex} +\def\review@documentclass{jsbook} +\def\review@booktitle_name{Re:VIEW Sample Book} +\def\review@aut_names{} +\def\review@titlepageauthors{} +\def\review@date{2011{-}01{-}01} +\def\review@language{ja} +\def\review@intn@list{リスト} +\def\review@intn@column_head{■コラム} +\def\review@intn@image{図} +\def\review@intn@table{表} +\def\review@intn@columnname{コラム} +\def\review@intn@memo_head{■メモ} +\def\review@intn@edition{版} +\def\review@intn@published_by{ 発行} +\def\review@toctitle{目次} +\def\review@prepartname{第} +\def\review@postpartname{部} +\def\review@prechaptername{第} +\def\review@postchaptername{章} +\def\review@figurename{図} +\def\review@tablename{表} +\def\review@appendixname{付録} +\def\review@titlepage{true} +\def\reviewprofilepagecont{\thispagestyle{empty}\chapter*{Profile} +some profile +} +\def\reviewadvfilepagecont{\thispagestyle{empty}\chapter*{Ad} +some ad content +} +\def\reviewbackcovercont{\clearpage +\thispagestyle{empty}\AddToShipoutPictureBG{% +\AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight]{images/backcover.png}} +} +\null} +\def\review@pubhistories{2011年1月1日 発行} +\def\review@colophon_names{} +\def\reviewprefacefiles{} +\def\reviewchapterfiles{} +\def\reviewappendixfiles{} +\def\reviewpostdeffiles{} -%%% profile -\thispagestyle{empty}\chapter*{Profile} -some profile +\makeatother -%%% advfile -\thispagestyle{empty}\chapter*{Ad} -some ad content +\begin{document} +%% coverpage +\ifdefined\reviewcoverpagecont +\reviewcoverpagecont +\fi -%%% colophon +%% title page +\ifdefined\reviewtitlepagecont +\reviewtitlepagecont +\fi -%%% backcover -\clearpage -\thispagestyle{empty}\AddToShipoutPictureBG{% -\AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight]{images/backcover.png}} -} -\null +%% frontmatter hook +\ifdefined\reviewfrontmatterhook +\reviewfrontmatterhook +\fi + +%% originaltitle +\ifdefined\revieworiginaltitlepagecont +\revieworiginaltitlepagecont +\fi + +%% credit +\ifdefined\reviewcreditfilecont +\reviewcreditfilecont +\fi + +%% preface +\ifdefined\reviewprefacefiles +\reviewprefacefiles +\fi + +%% toc +\ifdefined\reviewtableofcontents +\reviewtableofcontents +\fi + +%% mainmatter hook +\ifdefined\reviewmainmatterhook +\reviewmainmatterhook +\fi + +%% chapters body +\ifdefined\reviewchapterfiles +\reviewchapterfiles +\fi + +%% appendix hook +\ifdefined\reviewappendixhook +\reviewappendixhook +\fi + +%% appendix body +\ifdefined\reviewappendixfiles +\reviewappendixfiles +\fi + +%% backmatter hook +\ifdefined\reviewbackmatterhook +\reviewbackmatterhook +\fi + +%% postdef body +\ifdefined\reviewpostdeffiles +\reviewpostdeffiles +\fi + +%% index page +\ifdefined\reviewprintindex +\reviewprintindex +\fi + +%% profile page +\ifdefined\reviewprofilepagecont +\reviewprofilepagecont +\fi + +%% advfile page +\ifdefined\reviewadvfilepagecont +\reviewadvfilepagecont +\fi + +%%% colophon page +\ifdefined\reviewcolophonpagecont +\reviewcolophonpagecont +\fi + +%%% backcover page +\ifdefined\reviewbackcovercont +\reviewbackcovercont +\fi \end{document} diff --git a/test/sample-book/src/config.yml b/test/sample-book/src/config.yml index 4df90f6e9..dade26d82 100644 --- a/test/sample-book/src/config.yml +++ b/test/sample-book/src/config.yml @@ -54,7 +54,7 @@ epubmaker: # externallink: true pdfmaker: - texstyle: reviewmacro + texstyle: ["reviewmacro"] # texdocumentclass: ["jsbook", "uplatex,oneside"] # texcommand: "uplatex" # texoptions: null diff --git a/test/sample-book/src/sty/reviewmacro.sty b/test/sample-book/src/sty/reviewmacro.sty index dac325871..314d73bf4 100644 --- a/test/sample-book/src/sty/reviewmacro.sty +++ b/test/sample-book/src/sty/reviewmacro.sty @@ -1,39 +1 @@ -%% from review-pdfmaker -\usepackage{fancyhdr} -\pagestyle{fancy} -\lhead{\gtfamily\sffamily\bfseries\upshape \leftmark} -\chead{} -\rhead{\gtfamily\sffamily\bfseries\upshape \rightmark} -\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}{}} -\renewcommand{\chaptermark}[1]{\markboth{\prechaptername\ \thechapter\ \postchaptername~#1}{}} -\renewcommand{\headfont}{\gtfamily\sffamily\bfseries} - -\fancypagestyle{plainhead}{% -\fancyhead{} -\fancyfoot{} % clear all header and footer fields -\fancyfoot[CE,CO]{\thepage} -\renewcommand{\headrulewidth}{0pt} -\renewcommand{\footrulewidth}{0pt}} - -%% using Helvetica as sans-serif -\renewcommand{\sfdefault}{phv} - -%% for listings -%\renewcommand{\lstlistingname}{List} -%\lstset{% -% breaklines=true,% -% breakautoindent=false,% -% breakindent=0pt,% -% fontadjust=true,% -% backgroundcolor=\color{shadecolor},% -% frame=single,% -% framerule=0pt,% -% basicstyle=\ttfamily\scriptsize,% -% commentstyle=\color{reviewgreen},% -% identifierstyle=\color{reviewblue},% -% stringstyle=\color{reviewred},% -% keywordstyle=\bfseries\color{reviewdarkred},% -%} - - -\sloppy +% diff --git a/test/test_latexbuilder.rb b/test/test_latexbuilder.rb index 04ad64203..663af5960 100644 --- a/test/test_latexbuilder.rb +++ b/test/test_latexbuilder.rb @@ -50,7 +50,7 @@ def test_headline_level1_without_secno def test_headline_level1_with_inlinetag actual = compile_block(%Q(={test} this @{is} test.<&"_>\n)) - assert_equal %Q(\\chapter{this \\textbf{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n), actual + assert_equal %Q(\\chapter{this \\reviewbold{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n), actual end def test_headline_level2 @@ -111,12 +111,12 @@ def test_inline_br_with_other_strings def test_inline_i actual = compile_inline('abc@{def}ghi') - assert_equal 'abc\\textit{def}ghi', actual + assert_equal 'abc\\reviewit{def}ghi', actual end def test_inline_i_and_escape actual = compile_inline('test @{inline<&;\\ test} test2') - assert_equal 'test \\textit{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual + assert_equal 'test \\reviewit{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual end def test_inline_dtp @@ -126,7 +126,7 @@ def test_inline_dtp def test_inline_code actual = compile_inline('abc@{def}ghi') - assert_equal 'abc\\texttt{def}ghi', actual + assert_equal 'abc\\reviewcode{def}ghi', actual end def test_inline_raw @@ -146,12 +146,12 @@ def test_inline_sub def test_inline_b actual = compile_inline('abc@{def}') - assert_equal 'abc\\textbf{def}', actual + assert_equal 'abc\\reviewbold{def}', actual end def test_inline_b_and_escape actual = compile_inline('test @{inline<&;\\ test} test2') - assert_equal 'test \\textbf{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual + assert_equal 'test \\reviewbold{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual end def test_inline_em @@ -170,21 +170,23 @@ def test_inline_u end def test_inline_m + @config['review_version'] = '2.0' actual = compile_inline('abc@{\\alpha^n = \\inf < 2}ghi') assert_equal 'abc$\\alpha^n = \\inf < 2$ghi', actual - @config['review_version'] = '2.0' + @config['review_version'] = '3.0' actual = compile_inline('abc@{\\alpha^n = \\inf < 2}ghi') assert_equal 'abc $\\alpha^n = \\inf < 2$ ghi', actual end def test_inline_m2 + @config['review_version'] = '2.0' ## target text: @{X = \{ {x_1\},{x_2\}, \cdots ,{x_n\} \\\}} actual = compile_inline('@{X = \\{ {x_1\\},{x_2\\}, \\cdots ,{x_n\\} \\\\\\}}') ## expected text: $X = \{ {x_1},{x_2}, \cdots ,{x_n} \}$ assert_equal '$X = \\{ {x_1},{x_2}, \\cdots ,{x_n} \\}$', actual - @config['review_version'] = '2.0' + @config['review_version'] = '3.0' actual = compile_inline('@{X = \\{ {x_1\\},{x_2\\}, \\cdots ,{x_n\\} \\\\\\}}') ## expected text: $X = \{ {x_1},{x_2}, \cdots ,{x_n} \}$ assert_equal ' $X = \\{ {x_1},{x_2}, \\cdots ,{x_n} \\}$ ', actual @@ -192,22 +194,22 @@ def test_inline_m2 def test_inline_tt actual = compile_inline('test @{inline test} test2') - assert_equal 'test \\texttt{inline test} test2', actual + assert_equal 'test \\reviewtt{inline test} test2', actual end def test_inline_tt_endash actual = compile_inline('test @{in-line --test ---foo ----bar -----buz} --test2') - assert_equal 'test \\texttt{in{-}line {-}{-}test {-}{-}{-}foo {-}{-}{-}{-}bar {-}{-}{-}{-}{-}buz} {-}{-}test2', actual + assert_equal 'test \\reviewtt{in{-}line {-}{-}test {-}{-}{-}foo {-}{-}{-}{-}bar {-}{-}{-}{-}{-}buz} {-}{-}test2', actual end def test_inline_tti actual = compile_inline('test @{inline test} test2') - assert_equal 'test \\texttt{\\textit{inline test}} test2', actual + assert_equal 'test \\reviewtti{inline test} test2', actual end def test_inline_ttb actual = compile_inline('test @{inline test} test2') - assert_equal 'test \\texttt{\\textbf{inline test}} test2', actual + assert_equal 'test \\reviewttb{inline test} test2', actual end def test_inline_hd_chap @@ -412,7 +414,7 @@ def test_quote def test_memo actual = compile_block("//memo[this is @{test}<&>_]{\ntest1\n\ntest@{2}\n//}\n") - assert_equal %Q(\\begin{reviewminicolumn}\n\\reviewminicolumntitle{this is \\textbf{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}\ntest1\n\ntest\\textit{2}\n\\end{reviewminicolumn}\n), actual + assert_equal %Q(\\begin{reviewminicolumn}\n\\reviewminicolumntitle{this is \\reviewbold{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}\ntest1\n\ntest\\reviewit{2}\n\\end{reviewminicolumn}\n), actual end def test_flushright @@ -625,7 +627,7 @@ def @chapter.bibpaper(_id) end actual = compile_block("//bibpaper[samplebib][sample bib @{bold}]{\na\nb\n//}\n") - assert_equal %Q([1] sample bib \\textbf{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual + assert_equal %Q([1] sample bib \\reviewbold{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual end def test_bibpaper_without_body @@ -990,7 +992,7 @@ def test_inline_comment_for_draft def test_inline_fence actual = compile_inline('test @|@{$サンプル$}|') - assert_equal 'test \\texttt{@\\textless{}code\\textgreater{}\\{\\textdollar{}サンプル\\textdollar{}\\}}', actual + assert_equal 'test \\reviewcode{@\\textless{}code\\textgreater{}\\{\\textdollar{}サンプル\\textdollar{}\\}}', actual end def test_inline_w @@ -1006,7 +1008,7 @@ def test_inline_w actual = compile_block('@{F} @{B} @{B} @{N}') expected = <<-EOS -foo bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\} \\textbf{bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\}} [missing word: N] +foo bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\} \\reviewbold{bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\}} [missing word: N] EOS assert_equal expected, actual end diff --git a/test/test_pdfmaker.rb b/test/test_pdfmaker.rb index 37319dfa0..1137fde23 100644 --- a/test/test_pdfmaker.rb +++ b/test/test_pdfmaker.rb @@ -10,7 +10,7 @@ def setup @config.merge!( 'bookname' => 'sample', 'title' => 'Sample Book', - 'version' => 2, + 'review_version' => 3, 'urnid' => 'http://example.jp/', 'date' => '2011-01-01', 'language' => 'ja', @@ -141,6 +141,7 @@ def test_make_okuduke_dojin def test_template_content Dir.mktmpdir do @maker.basedir = Dir.pwd + @maker.erb_config tmpl = @maker.template_content expect = File.read(File.join(assets_dir, 'test_template.tex')) assert_equal(expect, tmpl) @@ -149,9 +150,9 @@ def test_template_content def test_gettemplate_with_backmatter @config.merge!( - 'backcover' => 'backcover.html', - 'profile' => 'profile.html', - 'advfile' => 'advfile.html' + 'backcover' => 'backcover.tex', + 'profile' => 'profile.tex', + 'advfile' => 'advfile.tex' ) Dir.mktmpdir do |dir| Dir.chdir(dir) do @@ -161,12 +162,10 @@ def test_gettemplate_with_backmatter File.open(File.join(dir, 'advfile.tex'), 'w') { |f| f.write(advfile) } backcover = "\\clearpage\n\\thispagestyle{empty}\\AddToShipoutPictureBG{%\n\\AtPageLowerLeft{\\includegraphics[width=\\paperwidth,height=\\paperheight]{images/backcover.png}}\n}\n\\null" File.open(File.join(dir, 'backcover.tex'), 'w') { |f| f.write(backcover) } - expect = File.read(File.join(assets_dir, 'test_template_backmatter.tex')) - @maker.basedir = Dir.pwd + @maker.erb_config tmpl = @maker.template_content - tmpl.gsub!(/\A.*%% backmatter begins\n/m, '') assert_equal(expect, tmpl) end end