From 367c341e746fc8492c74c2fde2c1bf95f4453938 Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Fri, 12 Feb 2021 10:55:41 +0900 Subject: [PATCH 1/4] add ird sty --- Gemfile.lock | 2 +- lib/review/retrovert/converter.rb | 16 +- lib/review/retrovert/sty/ird.sty | 302 ++++++++++++++++++++++++++++++ lib/review/retrovert/version.rb | 2 +- spec/review/retrovert_spec.rb | 10 +- 5 files changed, 328 insertions(+), 4 deletions(-) create mode 100644 lib/review/retrovert/sty/ird.sty diff --git a/Gemfile.lock b/Gemfile.lock index 1e3cd53..38ee9b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - review-retrovert (0.9.6) + review-retrovert (0.9.7) review (>= 3.0.0) thor diff --git a/lib/review/retrovert/converter.rb b/lib/review/retrovert/converter.rb index e333202..505aff1 100644 --- a/lib/review/retrovert/converter.rb +++ b/lib/review/retrovert/converter.rb @@ -101,7 +101,11 @@ def update_config(outdir) @configs.rewrite_yml('hook_beforetexcompile', 'null') @configs.rewrite_yml('texstyle', '["reviewmacro"]') pagesize = @config['starter']['pagesize'].downcase - @configs.rewrite_yml_array('texdocumentclass', "[\"review-jsbook\", \"media=print,paper=#{pagesize}\"]") + jsbook_config = "media=print,paper=#{pagesize}" + if @ird + jsbook_config = "media=ebook,paper=b5" + end + @configs.rewrite_yml_array('texdocumentclass', "[\"review-jsbook\", \"#{jsbook_config}\"]") @config['retrovert'].each{ |k,v| unless v..is_a?(Hash) @configs.commentout_root_yml(k) @@ -542,6 +546,15 @@ def preproc_contents(outdir, options) end end + def update_sty(outdir, options) + # FileUtils.cp(File.join(@basedir, 'sty/review-custom.sty'), File.join(outdir, 'sty/review-custom.sty')) + if @ird + FileUtils.cp(File.join(__dir__, 'sty/ird.sty'), File.join(outdir, 'sty/ird.sty')) + file = File.open(File.join(outdir, 'sty/review-custom.sty'), 'a') + file.puts('\RequirePackage{ird}') + end + end + def clean_initial_project(outdir) FileUtils.rm(File.join(outdir, 'config.yml')) FileUtils.rm(File.join(outdir, 'catalog.yml')) @@ -586,6 +599,7 @@ def execute(yamlfile, outdir, options) copy_images(outdir, store_image_dir) update_config(outdir) update_contents(outdir, options) + update_sty(outdir, options) pwd = Dir.pwd Dir.chdir(outdir) diff --git a/lib/review/retrovert/sty/ird.sty b/lib/review/retrovert/sty/ird.sty new file mode 100644 index 0000000..270b9bb --- /dev/null +++ b/lib/review/retrovert/sty/ird.sty @@ -0,0 +1,302 @@ +% +% フォント +% + +% \tiny 5pt +% \scriptsize 7pt +% \footnotesize 8pt +% \small 9pt +% \normalsize 10pt(標準) +% \large 12pt +% \Large 14.4pt +% \LARGE 17.28pt +% \huge 20.74pt +% \Huge + +\def\@setfontsize#1#2#3{% + \ifx\protect\@typeset@protect + \let\@currsize#1% + \fi + \fontsize{#2}{#3}\selectfont + \ifdim\parindent>\z@ + \if@english + \parindent=1em + \else + \parindent=1zw + \fi + \fi + \kanjiskip=0zw plus .1zw minus .01zw + \ifdim\xkanjiskip>\z@ + \if@slide \xkanjiskip=0.1em \else + % \xkanjiskip=0.25em plus 0.15em minus 0.06em + \xkanjiskip=0.2em plus 0.15em minus 0.16em + \fi + \fi +} + +% +% 章・節・項の変更 +% + +\def\@afterheading{% + \@nobreaktrue + \everypar{% + \if@nobreak + \@nobreakfalse + % \clubpenalty \@M + \clubpenalty \z@ % 段落一段目での改ページを許可する + \if@afterindent \else + {\setbox\z@\lastbox}% + \fi + \else + \clubpenalty \@clubpenalty + \everypar{\everyparhook}% + \fi\everyparhook}} + + +\def\@makechapterhead#1{% +% \vspace*{2\Cvs}% 欧文は50pt →上空きを無効化 + {\parindent \z@ \raggedright \normalfont + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \huge\headfont \@chapapp\thechapter\@chappos + % \par\nobreak + % \vskip \Cvs % 欧文は20pt + \fi + \fi + \interlinepenalty\@M + \huge \headfont \ #1\par\nobreak + \vskip 3\Cvs}} % 欧文は40pt + +% \usepackage[hiragino-pron]{pxchfon} +\renewcommand{\headfont}{\gtfamily\sffamily} + +\hyphenpenalty=10000\relax + +\renewcommand{\section}{% + \if@slide\clearpage\fi + \@startsection{section}{1}{\z@}% + {1.2\Cvs \@plus.3\Cdp \@minus1.2\Cdp}% 前アキ + {.4\Cvs \@plus.3\Cdp}% 後アキ + {\normalfont\large\bfseries\headfont\raggedright}} + +\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% + {.8\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% 前アキ + {.3\Cvs \@plus.8\Cdp}% 後アキ + {\normalfont\normalsize\headfont}} + +\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% + {.8\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% + {\if@slide .2\Cvs \@plus.6\Cdp \else \z@ \fi}% + {\normalfont\normalsize}% + } + +\def\@startsection#1#2#3#4#5#6{% + \if@noskipsec \leavevmode \fi + \par + \@tempskipa #4\relax + \if@english \@afterindentfalse \else \@afterindenttrue \fi + \ifdim \@tempskipa <\z@ + \@tempskipa -\@tempskipa \@afterindentfalse + \fi + \if@nobreak + \everypar{}% + \else + \addpenalty\@secpenalty\addvspace\@tempskipa + %改ページ後の不要な空白を削除 +% \addpenalty\@secpenalty +% \ifdim \@tempskipa >\z@ +% \if@slide +% \else +% \null +% \vspace*{-\baselineskip}% +% \fi +% \vskip\@tempskipa +% \fi + \fi + \noindent + \@ifstar + {\@ssect{#3}{#4}{#5}{#6}}% + {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} + +\def\@ssect#1#2#3#4#5{% + \@tempskipa #3\relax + \ifdim \@tempskipa<\z@ + \def\@svsechd{#4{\hskip #1\relax #5}}% + \else + \begingroup + #4{% + \@hangfrom{\hskip #1}% + \interlinepenalty \@M #5\@@par}% + \endgroup + \nopagebreak[4]% + \fi + \@xsect{#3}} + +\def\@xsect#1{% + \@tempskipa #1\relax + \ifdim \@tempskipa<\z@ + \@nobreakfalse + \global\@noskipsectrue + \everypar{% + \if@noskipsec + \global\@noskipsecfalse + {\setbox\z@\lastbox}% + \clubpenalty\@M + \begingroup \@svsechd \endgroup + \unskip + \@tempskipa #1\relax + \hskip -\@tempskipa + \else + \clubpenalty \@clubpenalty + \everypar{\everyparhook}% + \fi\everyparhook}% + \else + \nopagebreak[4] + \par \nobreak + \vskip \@tempskipa + \@afterheading + \fi + \if@slide + {\vskip\if@twocolumn-5\jsc@mpt\else-6\jsc@mpt\fi + \maybeblue\hrule height0\jsc@mpt depth1\jsc@mpt + \vskip\if@twocolumn 4\jsc@mpt\else 7\jsc@mpt\fi\relax}% + \fi + \par % 2000-12-18 + \ignorespaces} + +% +% コラムの変更 +% + +\renewenvironment{reviewcolumn}[1][]{% + \begin{framed} + \reviewcolumnhead{}{#1} + \footnotesize + }{% + \end{framed} + % \vspace{-2pt} + } + +\renewcommand{\reviewcolumnhead}[2]{% + {\noindent\large\bfseries #2}\vspace{1.7mm}} + + +% +% 図 +% + +\renewenvironment{reviewimage}{% + \begin{figure} + \begin{flushleft}}{% + \end{flushleft} + \end{figure} + \vspace*{-9.5pt} % not リュウミン + } + +% \renewcommand\reviewimagecaption[1]{% +% \captionsetup{format=hang,font=scriptsize,labelfont=bf,margin=50pt,name=図} +% \caption{ \bfseries\scriptsize{#1}} \vspace{-1.5mm}} + +\renewcommand\reviewimagecaption[1]{% + \captionsetup{format=hang,font=footnotesize,labelfont=bf,margin=0pt,justification=raggedright,singlelinecheck=off,name=図} + \vspace*{-2mm} \caption{ \bfseries\footnotesize{#1} } \vspace{-1.5mm}} + +% not リュウミン +% フォントのに対して幅が広くなりすぎて図が大きくなりすぎるので幅を狭める +\def\irdmaxwidth{0.965\textwidth} +\usepackage[export]{adjustbox} +\DeclareRobustCommand{\reviewincludegraphics}[2][]{% + \adjustbox{max width=\irdmaxwidth}{% + \includegraphics[#1]{#2}}% + } + +% +% 表 +% +\renewcommand{\reviewtablecaption}[1]{% + \captionsetup{format=hang,font=footnotesize,margin=70pt,name=表} + \caption{ \footnotesize{#1}} \vspace{-3mm}} + +\renewcommand{\reviewimgtablecaption}[1]{% + \captionsetup{format=hang,font=footnotesize,margin=70pt,name=表} + \caption{ \footnotesize\noindent{#1}} \vspace{-3mm}} + +% +% 箇条書き +% + +% 要素の間隔を 0 にする + +\usepackage{enumitem} +\setlist[enumerate]{topsep=0pt,parsep=0pt,partopsep=1pt} +\setlist[itemize]{topsep=0pt,parsep=0pt,partopsep=1pt} + +% +% リスト +% + +\renewcommand{\reviewlistcaption}[1]{% +\vspace*{0.6zw}\medskip{\small\noindent #1}\vspace*{-1.3zw}} + +\renewenvironment{reviewlist}{% + \begin{shaded}% + \vspace*{-1zw}% 前後の余白削除 + \small% + \ifdefined\reviewlistxkanjiskip% + \xkanjiskip=\reviewlistxkanjiskip% + \fi% + \setlength{\baselineskip}{1.3zw}% + \begin{alltt}}{% + \end{alltt}% + \vspace*{-1zw}% 前後の余白削除 + \end{shaded}% + \par% + % \vspace*{0.5zw}% + \vspace*{1zw}% + } + +% +% cmd +% + +\renewenvironment{reviewlistblock}{\needspace{\Cvs}}{} + +\renewenvironment{reviewcmd}{% + \medskip% + \ifdefined\reviewlistxkanjiskip% + \xkanjiskip=\reviewlistxkanjiskip% + \fi% + \vspace*{-2zw \@plus2.7\Cdp}% 枠の前の余白削除 + \begin{framed}% + \vspace*{-1zw}% 前後の余白削除 + % \setlength{\baselineskip}{1.3zw}% + \setlength{\baselineskip}{1.8zw}% + \begin{alltt}}{% + \end{alltt}% + \vspace*{-1zw}% 前後の余白削除 + \end{framed}% + % この値だといい感じになる + \vspace*{-0.28mm}% 枠の後ろの余白の調整 + } + +% \renewenvironment{reviewcmd}{% +% \medskip% +% \ifdefined\reviewlistxkanjiskip% +% \xkanjiskip=\reviewlistxkanjiskip% +% \fi% +% \vspace*{-2zw \@plus2.7\Cdp}% 枠の前の余白削除 +% \begin{framed}% +% \vspace*{-1zw}% 前後の余白削除 +% % \setlength{\baselineskip}{1.3zw}% +% \setlength{\baselineskip}{2zw}% +% \begin{alltt}}{% +% \end{alltt}% +% \vspace*{-1zw}% 前後の余白削除 +% \end{framed}% +% % この値だといい感じになる +% \vspace*{-0.2mm}% 枠の後ろの余白の調整 +% } + + % code +\DeclareRobustCommand{\reviewcode}[1]{{\small\ttfamily\reviewbreakall{#1}}} diff --git a/lib/review/retrovert/version.rb b/lib/review/retrovert/version.rb index a8c223c..63afe4e 100644 --- a/lib/review/retrovert/version.rb +++ b/lib/review/retrovert/version.rb @@ -1,5 +1,5 @@ module ReVIEW module Retrovert - VERSION = "0.9.6" + VERSION = "0.9.7" end end diff --git a/spec/review/retrovert_spec.rb b/spec/review/retrovert_spec.rb index 7373c22..58ce282 100644 --- a/spec/review/retrovert_spec.rb +++ b/spec/review/retrovert_spec.rb @@ -30,6 +30,7 @@ let(:inner) { 'tmp/contents/r0-inner.re' } let(:config) { 'tmp/config.yml' } let(:retrovert_config) { 'tmp/config-retrovert.yml' } + let(:custom_sty) { 'tmp/sty/review-custom.sty' } before(:each) { run_command("review-retrovert convert --preproc --tabwidth 4 --ird #{config_yaml} tmp") } it 'command result' do @@ -267,8 +268,15 @@ expect(root).to be_an_existing_file text = File.open(File.join(aruba.current_directory, root)).read() expect(text).not_to match(/^\s*@
{}\s*$/) - expect(text).to match(/^\s*.*@
{}\s*$/) + # expect(text).to match(/^\s*.*@
{}\s*$/) expect(text).to match(/^\/\/blankline$/) end + + it 'sty' do + expect('tmp/sty/ird.sty').to be_an_existing_file + expect(custom_sty).to be_an_existing_file + text = File.open(File.join(aruba.current_directory, custom_sty)).read() + expect(text).to include('\RequirePackage{ird}') + end end end From f818cef6e287ffa9b537a8785b93cb1a048a1369 Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Fri, 12 Feb 2021 11:13:48 +0900 Subject: [PATCH 2/4] fix jsbook config --- lib/review/retrovert/converter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/review/retrovert/converter.rb b/lib/review/retrovert/converter.rb index 505aff1..430998e 100644 --- a/lib/review/retrovert/converter.rb +++ b/lib/review/retrovert/converter.rb @@ -103,7 +103,7 @@ def update_config(outdir) pagesize = @config['starter']['pagesize'].downcase jsbook_config = "media=print,paper=#{pagesize}" if @ird - jsbook_config = "media=ebook,paper=b5" + jsbook_config = "media=ebook,openany,paper=b5,fontsize=10pt,baselineskip=16pt,head_space=15mm,gutter=22mm,footskip=16mm,line_length=45zw,number_of_lines=38" end @configs.rewrite_yml_array('texdocumentclass', "[\"review-jsbook\", \"#{jsbook_config}\"]") @config['retrovert'].each{ |k,v| From 56cdf686b38799fdad8d75f78b241d09175f22eb Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Sun, 14 Feb 2021 21:55:41 +0900 Subject: [PATCH 3/4] update for ird --- lib/review/retrovert/converter.rb | 11 +- lib/review/retrovert/ext/review-ext.rb | 71 ++++++++++ lib/review/retrovert/sty/ird.sty | 172 ++++++++++++++----------- spec/review/retrovert_spec.rb | 4 + 4 files changed, 179 insertions(+), 79 deletions(-) create mode 100644 lib/review/retrovert/ext/review-ext.rb diff --git a/lib/review/retrovert/converter.rb b/lib/review/retrovert/converter.rb index 430998e..ad37c88 100644 --- a/lib/review/retrovert/converter.rb +++ b/lib/review/retrovert/converter.rb @@ -103,7 +103,9 @@ def update_config(outdir) pagesize = @config['starter']['pagesize'].downcase jsbook_config = "media=print,paper=#{pagesize}" if @ird - jsbook_config = "media=ebook,openany,paper=b5,fontsize=10pt,baselineskip=16pt,head_space=15mm,gutter=22mm,footskip=16mm,line_length=45zw,number_of_lines=38" + # # リュウミン Pr6N R-KL 12.5Q 22H (9pt = 12.7Q 15.5pt = 21.8Q(H)) + # texdocumentclass: ["review-jsbook", "media=ebook,openany,paper=b5,fontsize=9pt,baselineskip=15.5pt,head_space=15mm,gutter=22mm,footskip=16mm,line_length=45zw,number_of_lines=38"] + jsbook_config = "media=ebook,openany,paper=b5,fontsize=9pt,baselineskip=15.5pt,head_space=15mm,gutter=22mm,footskip=16mm,line_length=45zw,number_of_lines=38" end @configs.rewrite_yml_array('texdocumentclass', "[\"review-jsbook\", \"#{jsbook_config}\"]") @config['retrovert'].each{ |k,v| @@ -555,6 +557,12 @@ def update_sty(outdir, options) end end + def update_ext(outdir, options) + if @ird + FileUtils.cp(File.join(__dir__, 'ext/review-ext.rb'), File.join(outdir, 'review-ext.rb')) + end + end + def clean_initial_project(outdir) FileUtils.rm(File.join(outdir, 'config.yml')) FileUtils.rm(File.join(outdir, 'catalog.yml')) @@ -600,6 +608,7 @@ def execute(yamlfile, outdir, options) update_config(outdir) update_contents(outdir, options) update_sty(outdir, options) + update_ext(outdir, options) pwd = Dir.pwd Dir.chdir(outdir) diff --git a/lib/review/retrovert/ext/review-ext.rb b/lib/review/retrovert/ext/review-ext.rb new file mode 100644 index 0000000..8ca87fe --- /dev/null +++ b/lib/review/retrovert/ext/review-ext.rb @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +## +## ReVIEW::LATEXBuilderクラスを拡張する +## + +require 'review/latexbuilder' + + +module ReVIEW + + defined?(LATEXBuilder) or raise "internal error: LATEXBuilder not found." + + + module LATEXBuilderForIRD + # def headline(level, label, caption) + # if level >= 4 + # puts '\needspace{3zh}' + # end + # super(level,label,caption) + # puts '\nopagebreak[4]' + # end + + def ul_begin + blank + puts '\begin{reviewitemize}' + end + def ul_end + puts '\end{reviewitemize}' + blank + end + end + + class LATEXBuilder + prepend LATEXBuilderForIRD + + # def headline(level, label, caption) + # _, anchor = headline_prefix(level) + # headline_name = HEADLINE[level] + # if @chapter.is_a?(ReVIEW::Book::Part) + # if @book.config.check_version('2', exception: false) + # headline_name = 'part' + # elsif level == 1 + # headline_name = 'part' + # puts '\begin{reviewpart}' + # end + # end + # prefix = '' + # if level > @book.config['secnolevel'] || (@chapter.number.to_s.empty? && level > 1) + # prefix = '*' + # end + # blank unless @output.pos == 0 + # @doc_status[:caption] = true + # puts macro(headline_name + prefix, compile_inline(caption)) + # puts '\nopagebreak[4]' + # @doc_status[:caption] = nil + # if prefix == '*' && level <= @book.config['toclevel'].to_i + # puts "\\addcontentsline{toc}{#{headline_name}}{#{compile_inline(caption)}}" + # end + # if level == 1 + # puts macro('label', chapter_label) + # else + # puts macro('label', sec_label(anchor)) + # puts macro('label', label) if label + # end + # puts '\nopagebreak[4]' + # rescue + # error "unknown level: #{level}" + # end + end +end diff --git a/lib/review/retrovert/sty/ird.sty b/lib/review/retrovert/sty/ird.sty index 270b9bb..bb464d4 100644 --- a/lib/review/retrovert/sty/ird.sty +++ b/lib/review/retrovert/sty/ird.sty @@ -71,25 +71,24 @@ % \usepackage[hiragino-pron]{pxchfon} \renewcommand{\headfont}{\gtfamily\sffamily} -\hyphenpenalty=10000\relax +% \hyphenpenalty=10000\relax \renewcommand{\section}{% \if@slide\clearpage\fi \@startsection{section}{1}{\z@}% - {1.2\Cvs \@plus.3\Cdp \@minus1.2\Cdp}% 前アキ - {.4\Cvs \@plus.3\Cdp}% 後アキ + {1.3\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% 前アキ + {.5\Cvs \@plus.3\Cdp}% 後アキ {\normalfont\large\bfseries\headfont\raggedright}} \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% {.8\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% 前アキ - {.3\Cvs \@plus.8\Cdp}% 後アキ + {.5\Cvs \@plus.3\Cdp}% 後アキ {\normalfont\normalsize\headfont}} \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% - {.8\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% - {\if@slide .2\Cvs \@plus.6\Cdp \else \z@ \fi}% - {\normalfont\normalsize}% - } + {.6\Cvs \@plus.5\Cdp \@minus1.2\Cdp}% + {\if@slide .2\Cvs \@plus.6\Cdp \else .2\Cvs \@plus.3\Cdp \fi}% + {\normalfont\normalsize}} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi @@ -119,60 +118,65 @@ {\@ssect{#3}{#4}{#5}{#6}}% {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} -\def\@ssect#1#2#3#4#5{% - \@tempskipa #3\relax - \ifdim \@tempskipa<\z@ - \def\@svsechd{#4{\hskip #1\relax #5}}% - \else - \begingroup - #4{% - \@hangfrom{\hskip #1}% - \interlinepenalty \@M #5\@@par}% - \endgroup - \nopagebreak[4]% - \fi - \@xsect{#3}} - -\def\@xsect#1{% - \@tempskipa #1\relax - \ifdim \@tempskipa<\z@ - \@nobreakfalse - \global\@noskipsectrue - \everypar{% - \if@noskipsec - \global\@noskipsecfalse - {\setbox\z@\lastbox}% - \clubpenalty\@M - \begingroup \@svsechd \endgroup - \unskip - \@tempskipa #1\relax - \hskip -\@tempskipa - \else - \clubpenalty \@clubpenalty - \everypar{\everyparhook}% - \fi\everyparhook}% - \else - \nopagebreak[4] - \par \nobreak - \vskip \@tempskipa - \@afterheading - \fi - \if@slide - {\vskip\if@twocolumn-5\jsc@mpt\else-6\jsc@mpt\fi - \maybeblue\hrule height0\jsc@mpt depth1\jsc@mpt - \vskip\if@twocolumn 4\jsc@mpt\else 7\jsc@mpt\fi\relax}% - \fi - \par % 2000-12-18 - \ignorespaces} +% \def\@ssect#1#2#3#4#5{% +% \@tempskipa #3\relax +% \ifdim \@tempskipa<\z@ +% \def\@svsechd{#4{\hskip #1\relax #5}}% +% \else +% \begingroup +% #4{% +% \@hangfrom{\hskip #1}% +% \interlinepenalty \@M #5\@@par}% +% \endgroup +% \nopagebreak[4]% +% \fi +% \@xsect{#3}} + +% \def\@xsect#1{% +% \@tempskipa #1\relax +% \ifdim \@tempskipa<\z@ +% \@nobreakfalse +% \global\@noskipsectrue +% \everypar{% +% \if@noskipsec +% \global\@noskipsecfalse +% {\setbox\z@\lastbox}% +% \clubpenalty\@M +% \begingroup \@svsechd \endgroup +% \unskip +% \@tempskipa #1\relax +% \hskip -\@tempskipa +% \else +% \clubpenalty \@clubpenalty +% \everypar{\everyparhook}% +% \fi\everyparhook}% +% \else +% \nopagebreak[4] +% \par \nobreak +% \vskip \@tempskipa +% \@afterheading +% \fi +% \if@slide +% {\vskip\if@twocolumn-5\jsc@mpt\else-6\jsc@mpt\fi +% \maybeblue\hrule height0\jsc@mpt depth1\jsc@mpt +% \vskip\if@twocolumn 4\jsc@mpt\else 7\jsc@mpt\fi\relax}% +% \fi +% \par % 2000-12-18 +% \ignorespaces} % % コラムの変更 % +\def\ifempty#1{\def\temp{#1} \ifx\temp\empty } + \renewenvironment{reviewcolumn}[1][]{% - \begin{framed} - \reviewcolumnhead{}{#1} - \footnotesize + \begin{framed} + \ifempty{#1}% + \else% + \reviewcolumnhead{}{#1}% + \fi% + \footnotesize }{% \end{framed} % \vspace{-2pt} @@ -191,7 +195,7 @@ \begin{flushleft}}{% \end{flushleft} \end{figure} - \vspace*{-9.5pt} % not リュウミン + \vspace{-5.5pt} } % \renewcommand\reviewimagecaption[1]{% @@ -200,16 +204,15 @@ \renewcommand\reviewimagecaption[1]{% \captionsetup{format=hang,font=footnotesize,labelfont=bf,margin=0pt,justification=raggedright,singlelinecheck=off,name=図} - \vspace*{-2mm} \caption{ \bfseries\footnotesize{#1} } \vspace{-1.5mm}} - -% not リュウミン -% フォントのに対して幅が広くなりすぎて図が大きくなりすぎるので幅を狭める -\def\irdmaxwidth{0.965\textwidth} -\usepackage[export]{adjustbox} -\DeclareRobustCommand{\reviewincludegraphics}[2][]{% - \adjustbox{max width=\irdmaxwidth}{% - \includegraphics[#1]{#2}}% - } + \vspace{-1mm} \caption{ \bfseries\footnotesize{#1} } \vspace{-1.5mm}} + +% % フォントのに対して調整 +% \def\irdmaxwidth{0.99\textwidth} +% \usepackage[export]{adjustbox} +% \DeclareRobustCommand{\reviewincludegraphics}[2][]{% +% \adjustbox{max width=\irdmaxwidth}{% +% \includegraphics[#1]{#2}}% +% } % % 表 @@ -226,11 +229,24 @@ % 箇条書き % -% 要素の間隔を 0 にする - -\usepackage{enumitem} -\setlist[enumerate]{topsep=0pt,parsep=0pt,partopsep=1pt} -\setlist[itemize]{topsep=0pt,parsep=0pt,partopsep=1pt} +% \usepackage{enumitem} +% \setlist[enumerate]{topsep=0pt,parsep=1pt} +% \setlist[itemize]{topsep=0pt,parsep=1pt} + +\newenvironment{reviewitemize}{% + \ifnum\@listdepth=0% + \def\@listi{% + \@listI% + % \topsep 0.1\baselineskip% % 上下の余白を減らす(original: 0.5\baselineskip) + % \topsep \z@% % 上下の余白を減らす(original: 0.5\baselineskip) + \topsep -0.25\baselineskip% % 上下の余白を減らす(original: 0.5\baselineskip) + }% + \fi% + \begin{itemize}% + \setlength{\parskip}{-0.6pt}% 要素の間隔を詰める +}{% + \end{itemize}% +} % % リスト @@ -267,17 +283,17 @@ \ifdefined\reviewlistxkanjiskip% \xkanjiskip=\reviewlistxkanjiskip% \fi% - \vspace*{-2zw \@plus2.7\Cdp}% 枠の前の余白削除 + \vspace*{-2.5zw \@plus.3\Cdp}% 枠の前の余白削除 \begin{framed}% - \vspace*{-1zw}% 前後の余白削除 + % \interlinepenalty=10000% + \vspace*{-0.8zw}% 前後の余白削除 % \setlength{\baselineskip}{1.3zw}% - \setlength{\baselineskip}{1.8zw}% + \setlength{\baselineskip}{2zw}% \begin{alltt}}{% \end{alltt}% - \vspace*{-1zw}% 前後の余白削除 + \vspace*{-0.8zw}% 前後の余白削除 \end{framed}% - % この値だといい感じになる - \vspace*{-0.28mm}% 枠の後ろの余白の調整 + \vspace*{0.3mm}% 枠の後ろの余白の調整 } % \renewenvironment{reviewcmd}{% diff --git a/spec/review/retrovert_spec.rb b/spec/review/retrovert_spec.rb index 58ce282..256de37 100644 --- a/spec/review/retrovert_spec.rb +++ b/spec/review/retrovert_spec.rb @@ -278,5 +278,9 @@ text = File.open(File.join(aruba.current_directory, custom_sty)).read() expect(text).to include('\RequirePackage{ird}') end + + it 'ext' do + expect('tmp/review-ext.rb').to be_an_existing_file + end end end From ce0081f2d8b2e088841cb1229fcb17099f97a98e Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Tue, 16 Feb 2021 11:54:20 +0900 Subject: [PATCH 4/4] update README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index e33d928..aaff01a 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,13 @@ inherit: ["config-base.yml", "config-starter.yml", "config-retrovert.yml"] #chapterlink: true ``` +## Experimental + +### IRD sty + +--ird オプションを付けると IRD 組版に近いレイアウトにするために ird.sty と reveiw-ext.rb をプロジェクトに追加します。 +こちらは実験的機能です。 + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.