Skip to content

Commit

Permalink
Better support for Japanese #34 by kshramt
Browse files Browse the repository at this point in the history
  • Loading branch information
ftilmann committed Dec 6, 2015
1 parent 27615b3 commit 5ad4074
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ cleanall: clean cleantest
\rm -r dist

test:
cd testsuite; verify --run
cd testsuite; ./verify --run



4 changes: 3 additions & 1 deletion latexdiff
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# Version 1.1.1alpha
# - patch mhchem: allow ce in equations
# - flatten now also expands \input etc. in the preamble (but not \usepackage!)
# - Better support for Japanese ( contributed by github user kshramt )
#
# Version 1.1.0
# - treat diacritics (\",\', etc) as safe commands
Expand Down Expand Up @@ -577,7 +578,8 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/);
# such that a\_b is interpreted as a{\_}b by latex but a{\_b} by perl
my $quotedunderscore='\\\\_';
# word: sequence of letters or accents followed by letter
my $word='(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])+';
my $word_ja='\p{Han}+|\p{InHiragana}+|\p{InKatakana}+';
my $word='(?:' . $word_ja . '|(?:(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])(?!(?:' . $word_ja . ')))+)';
my $cmdleftright='\\\\(?:left|right|[Bb]igg?[lrm]?|middle)\s*(?:[<>()\[\]|]|\\\\(?:[|{}]|\w+))';
### my $word='(?:[-\p{IsL}*]|\\\\[\"\'\`~^][\p{IsL}A-Za-z\*])+';
### standard $cmdoptseq without intervening spaces
Expand Down
30 changes: 30 additions & 0 deletions testsuite/ja-diff-1.1.0.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
\documentclass{ltjsarticle}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL ja-old.tex Fri Dec 4 17:00:51 2015
%DIF ADD ja-new.tex Fri Dec 4 17:00:26 2015
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF CFONT PREAMBLE %DIF PREAMBLE
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{blue} \sf #1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red} \scriptsize #1}} %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

例えば\DIFdelbegin \DIFdel{S}\DIFdelend \DIFaddbegin \DIFadd{P}\DIFaddend 波の到達時刻を知りたい場合,\DIFdelbegin \DIFdel{ジェフェリーズ}\DIFdelend \DIFaddbegin \DIFadd{ジェフリーズ}\DIFaddend とブレンの\DIFdelbegin \DIFdel{掃除表}\DIFdelend \DIFaddbegin \DIFadd{走時表}\DIFaddend が使\DIFdelbegin \DIFdel{えますか?
}\DIFdelend \DIFaddbegin \DIFadd{えます.
}\DIFaddend

\end{document}
7 changes: 7 additions & 0 deletions testsuite/ja-new.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
\documentclass{ltjsarticle}

\begin{document}

例えばP波の到達時刻を知りたい場合,ジェフリーズとブレンの走時表が使えます.

\end{document}
7 changes: 7 additions & 0 deletions testsuite/ja-old.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
\documentclass{ltjsarticle}

\begin{document}

例えばS波の到達時刻を知りたい場合,ジェフェリーズとブレンの掃除表が使えますか?

\end{document}
13 changes: 10 additions & 3 deletions testsuite/verify
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ set testroots=( test rapine_et_al island_obs2004 texdiffsample gershwin12 gershw
delequ latin9 pollack move-equation nomarkup subscript doubledollar \
DIFDELCMDBUG eqnarray subscriptm delequ2 schneider gennady umesh underwood endfloat outerrise \
delequ3 delequ4 "simplefrac --allow-spaces" "master --flatten" titlediffTest2 exampleDiff bornd2 \
"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units )
"rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units \
)

#set testroots= ( test subscript )
### Note that ja tex needs lualatex
###<<<<<<< HEAD
###=======
###"ja --encoding=utf8 --type=CFONT" \
###)
###>>>>>>> b81af5579366f393f813580575b2a5e58801a08c
# ttest-siunitx ttest-glossaries ttest-chem ttest-cleveref


Expand Down Expand Up @@ -54,7 +61,7 @@ while ( $#testroots >= 1 )
set sample=( $testroots[1] )
shift testroots
if ( $#sample > 1 ) then
set eopt=$sample[2-]
set eopt="$sample[2-]"
else
set eopt
endif
Expand Down Expand Up @@ -107,7 +114,7 @@ while ( $#testroots >= 1 )
endif
run:
if ( $run ) then
pdflatex -interaction=batchmode ${sample}-diff.tex
pdflatex -interaction=batchmode ${sample}-diff.tex

if ($status || ! -e ${sample}-diff.pdf ) then
echo "Compilation of ${sample}-diff.tex did not complete as expected."
Expand Down

0 comments on commit 5ad4074

Please sign in to comment.