Skip to content

Commit

Permalink
Merge pull request #1352 from kmuto/reviewbreakall
Browse files Browse the repository at this point in the history
introduce reviewbreakall
  • Loading branch information
kmuto authored Aug 11, 2019
2 parents 6707fc5 + bf57698 commit 68737e9
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 8 deletions.
56 changes: 52 additions & 4 deletions templates/latex/review-jlreq/review-base.sty
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,58 @@
\DeclareRobustCommand{\reviewunderline}[1]{\underline{#1}}% ulemかjumolineで上書き。デフォルトはulemにしている
\DeclareRobustCommand{\reviewit}[1]{\textit{#1}}
\DeclareRobustCommand{\reviewbold}[1]{\textbf{#1}}
\DeclareRobustCommand{\reviewcode}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtt}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtti}[1]{\texttt{\textit{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{\texttt{\textbf{#1}}}

% allow break line in tt
% contributed by @zr_tex8r
\newif\ifreview@ba@break
\def\review@ba@end{\review@ba@end@}
\DeclareRobustCommand{\reviewbreakall}[1]{%
\begingroup
\review@ba@breakfalse
\review@break@all@a#1\review@ba@end
\endgroup
}
\def\review@break@all@a{%
\futurelet\review@ba@tok\review@break@all@b
}
\def\review@break@all@b{%
\ifx\review@ba@tok\review@ba@end
\let\next\@gobble
\else\ifx\review@ba@tok\@sptoken
\let\next\review@break@all@c
\else\ifx\review@ba@tok~%
\let\next\review@break@all@d
\else\ifx\review@ba@tok\bgroup
\let\next\review@break@all@e
\else
\let\next\review@break@all@f
\fi\fi\fi\fi
\next
}
\expandafter\def\expandafter\review@break@all@c\space{%
\space
\review@ba@breakfalse
\review@break@all@a
}
\def\review@break@all@d#1{%
\review@break@all@f{\mbox{\space}}%
}
\def\review@break@all@e#1{%
\review@break@all@f{{#1}}%
}
\def\review@break@all@f#1{%
\ifreview@ba@break
\hskip0pt plus 0.02em\relax
\fi
#1%
\review@ba@breaktrue
\review@break@all@a
}
\DeclareRobustCommand{\reviewtt}[1]{{\ttfamily\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewcode}[1]{{\ttfamily\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewtti}[1]{{\ttfamily\itshape\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{{\ttfamily\bfseries\reviewbreakall{#1}}}

\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}

%% @<del> is ignored in LaTeX with default style
Expand Down
56 changes: 52 additions & 4 deletions templates/latex/review-jsbook/review-base.sty
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,58 @@
\DeclareRobustCommand{\reviewunderline}[1]{\Underline{#1}}
\DeclareRobustCommand{\reviewit}[1]{\textit{#1}}
\DeclareRobustCommand{\reviewbold}[1]{\textbf{#1}}
\DeclareRobustCommand{\reviewcode}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtt}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtti}[1]{\texttt{\textit{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{\texttt{\textbf{#1}}}

% allow break line in tt
% contributed by @zr_tex8r
\newif\ifreview@ba@break
\def\review@ba@end{\review@ba@end@}
\DeclareRobustCommand{\reviewbreakall}[1]{%
\begingroup
\review@ba@breakfalse
\review@break@all@a#1\review@ba@end
\endgroup
}
\def\review@break@all@a{%
\futurelet\review@ba@tok\review@break@all@b
}
\def\review@break@all@b{%
\ifx\review@ba@tok\review@ba@end
\let\next\@gobble
\else\ifx\review@ba@tok\@sptoken
\let\next\review@break@all@c
\else\ifx\review@ba@tok~%
\let\next\review@break@all@d
\else\ifx\review@ba@tok\bgroup
\let\next\review@break@all@e
\else
\let\next\review@break@all@f
\fi\fi\fi\fi
\next
}
\expandafter\def\expandafter\review@break@all@c\space{%
\space
\review@ba@breakfalse
\review@break@all@a
}
\def\review@break@all@d#1{%
\review@break@all@f{\mbox{\space}}%
}
\def\review@break@all@e#1{%
\review@break@all@f{{#1}}%
}
\def\review@break@all@f#1{%
\ifreview@ba@break
\hskip0pt plus 0.02em\relax
\fi
#1%
\review@ba@breaktrue
\review@break@all@a
}
\DeclareRobustCommand{\reviewtt}[1]{{\ttfamily\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewcode}[1]{{\ttfamily\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewtti}[1]{{\ttfamily\itshape\reviewbreakall{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{{\ttfamily\bfseries\reviewbreakall{#1}}}

\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}

%% @<del> is ignored in LaTeX with default style
Expand Down

0 comments on commit 68737e9

Please sign in to comment.