texlive[45194] Master: fixjfm (2sep17)

commits+karl at tug.org commits+karl at tug.org
Sat Sep 2 23:30:30 CEST 2017

Revision: 45194
Author:   karl
Date:     2017-09-02 23:30:30 +0200 (Sat, 02 Sep 2017)
Log Message:
fixjfm (2sep17)

Modified Paths:

Added Paths:

Added: trunk/Master/texmf-dist/doc/generic/fixjfm/README.txt
--- trunk/Master/texmf-dist/doc/generic/fixjfm/README.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/fixjfm/README.txt	2017-09-02 21:30:30 UTC (rev 45194)
@@ -0,0 +1,16 @@
+The fixjfm package --- Fix JFM (for *pTeX)
+CTAN Homepage: https://ctan.org/pkg/fixjfm
+Repository: https://github.com/Man-Ting-Fang/fixjfm
+Version: 2017-09-02 v0.2
+Copyright 2017 Yue ZHANG
+License: Knuth License (https://ctan.org/license/knuth)
+This package fixes several bugs in the JFM format. Both LaTeX and plain TeX are

Property changes on: trunk/Master/texmf-dist/doc/generic/fixjfm/README.txt
Added: svn:eol-style
## -0,0 +1 ##
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.pdf
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.pdf
--- trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.pdf	2017-09-02 21:29:34 UTC (rev 45193)
+++ trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.pdf	2017-09-02 21:30:30 UTC (rev 45194)

Property changes on: trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.pdf
Added: svn:mime-type
## -0,0 +1 ##
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.tex
--- trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.tex	2017-09-02 21:30:30 UTC (rev 45194)
@@ -0,0 +1,267 @@
+% fixjfm-doc.tex
+% !TeX encoding = UTF-8
+% !TeX program  = pdfLaTeX
+\newcommand\FwBox{\ensuremath{\square}\hskip0em plus 0.05em\relax}
+  \FourFwBoxes\FourFwBoxes\FourFwBoxes\FourFwBoxes
+  \FourFwBoxes\FourFwBoxes\ensuremath{\square}}
+  \begin{minipage}{20\wd\fwbox}\centering
+    \fbox{\begin{minipage}{16\wd\fwbox}%
+      \hskip2\wd\fwbox\relax\DemoText\par
+      \leavevmode\hbox to#1\wd\fwbox{\hss``}\DemoText''\par
+      \hskip2\wd\fwbox\relax\DemoText\par
+    \end{minipage}}%
+  \end{minipage}}
+\font\eclmvtt=ec-lmvtt10 at 10pt
+  \hbox to 1\wd\fwbox{\texttt{,}\hss}#1%
+  \hbox to 1\wd\fwbox{\hss{\eclmvtt``}}\TwoFwBoxes
+  \hbox to 1\wd\fwbox{{\eclmvtt''}\hss}#2}
+  \TwoFwBoxes\hbox to#1\wd\fwbox{,\hss{#2``}}\TwoFwBoxes{#2''}}
+\font\sans=SourceSansPro-Semibold-tlf-ot1 at 10pt
+\title{The \pkg{fixjfm} package%
+  \thanks{CTAN Homepage: \texttt{https://ctan.org/pkg/fixjfm}}
+  \thanks{Repository: \texttt{https://github.com/Man-Ting-Fang/fixjfm}}}
+\author{Yue \textsc{Zhang}}
+\date{2017-09-02\quad v0.2}
+This package fixes several bugs in the JFM format.
+The JFM format is an extension of the TFM format and is used for typesetting CJK
+characters with *\pTeX. It works perfectly under almost all circumstances, but
+there are still at least two bugs:
+\item Bug 1: the indentation is incorrect if the first character of a paragraph
+  is an opening fullwidth punctuation mark, see Figure \ref{fig:ind};
+\item Bug 2: the spacing between two consecutive fullwidth punctuation marks
+  cannot be adjusted if the font is changed there, see Table \ref{tab:adj}.
+\caption{Comparison of the indentation produced without this package (left) and
+  with this package (right)}
+\caption{Comparison of the adjustment of the spacing between two consecutive
+  fullwidth punctuation marks}
+Font change & This package        & Input          & Output                  \\
+\no         & either \no\ or \yes & \demoinput{}{} & \demooutput{1.5}{}      \\
+\yes        & \no                 & \demoinput{\texttt{\char"5C textgt%
+                                      \char"7B}}{\texttt{\char"7D}}
+                                                   & \demooutput{2}{\sans}   \\
+\yes        & \yes                & \demoinput{\texttt{\char"5C textgt%
+                                      \char"7B}}{\texttt{\char"7D}}
+                                                   & \demooutput{1.5}{\sans} \\
+It seems that macro is the easiest solution to these problems. However, the
+second bug can only be fixed when using \e-(u)\pTeX\ (under most, but not all
+circumstances), because the primitive \verb|\lastnodechar| which is introduced
+by \epTeX\ is required. Anyhow, using this package with \pTeX\ or any one of its
+derivatives does not hurt. Please also keep in mind that owing to technical
+limitations, this package is not a panacea.
+There is also another improvement: \verb|\leavevmode| is redefined as
+\verb|\quitvmode| if the latter is available as a primitive (among all *\pTeX\
+engines to date, only \ApTeX\ has \verb|\quitvmode|). So after loading this
+package, you can always use \verb|\leavevmode| and need not worry about
+\verb|\quitvmode|. If you are wondering about what the difference between them
+is, please see \textit{The pdf\TeX\ user manual}.
+\section{Basic usage}
+This package has no options. It is recommended that this package should be
+loaded before any other packages. If you are using \LaTeX, load this package at
+the beginning of your preamble:
+    \documentclass...
+    \usepackage{fixjfm}
+or even before \verb|\documentclass| (use \verb|\RequirePackage| instead):
+    \RequirePackage{fixjfm}
+    \documentclass...
+If you are using plain \TeX, put the following line near the beginning of your
+\verb|.tex| file:
+    \input fixjfm.sty
+After loading this package, the first bug mentioned above can be automatically
+fixed under most (but not all) circumstances. If you find that it cannot be
+fixed somewhere, you can add \verb|\<| manually before the opening fullwidth
+punctuation mark which begins the paragraph.
+In the case of the second bug mentioned above, the situation is different. If
+you are using \LaTeX, \verb|\textmc| and \verb|\textgt| are redefined by default
+so that the bug can be automatically fixed (again, under most, but not all
+circumstances). However, \verb|\mcfamily| and \verb|\gtfamily| remain unchanged.
+The difference here is similar to that between, say, \verb|\textit| and
+\verb|\itshape|: \verb|\textit| automatically takes care of any necessary italic
+correction on either side of the argument, while \verb|\itshape| does nothing
+about that. Just like \verb|\itshape| and \verb|\/|, you should add
+    \fixjfmspacing
+by yourself after the font change that appears between two consecutive fullwidth
+punctuation marks. For example:
+\hbox to 1\wd\fwbox{\texttt{,}\hss}\verb|{\gtfamily\fixjfmspacing|%
+\hbox to 1\wd\fwbox{\hss{\eclmvtt``}}\TwoFwBoxes
+\hbox to 1\wd\fwbox{{\eclmvtt''}\hss}\verb|}\fixjfmspacing|%
+\hbox to 1\wd\fwbox{\hss{\eclmvtt``}}\TwoFwBoxes
+\hbox to 1\wd\fwbox{{\eclmvtt''}\hss}%
+If you are using plain \TeX, you should always add \verb|\fixjfmspacing| by
+yourself, because plain (*p)\TeX\ does not have \verb|\textmc|, \verb|\textgt|,
+or the like.
+Incidentally, if you are using \LaTeX\ and prefer the original (u)\pLaTeX\
+version of \verb|\textmc| and \verb|\textgt|, you can declare
+    \UseStandardCJKTextFontCommands
+in your preamble. In contrast,
+    \UseFixJFMCJKTextFontCommands
+redefines \verb|\textmc| and \verb|\textgt| and is declared by default. These
+two commands can only be used in preamble.
+\section{Advanced usage}
+The spacing between two consecutive fullwidth punctuation marks is produced by
+a glue item specified in the corresponding JFM file. However, if the font is
+changed there, the JFM format cannot work correctly, so this package puts
+another glue item there to adjust the spacing. The natural width of the new glue
+item is calculated according to the corresponding JFM file, so you need not
+worry about it. However, the stretch and shrink components cannot be extracted
+from JFM, so the following two commands are provided:
+    \SetFixJFMSpacingStretch
+    \SetFixJFMSpacingShrink
+They expect an argument specifying how much space to stretch and shrink
+respectively. This package sets both of them to \verb|0.05zw| by default.
+Macro writers may want to (re)define commands like the \pkg{fixjfm} version of
+\verb|\textmc| and \verb|\textgt| for CJK fonts, thus the following command is
+    \DeclareFixJFMCJKTextFontCommand
+It is similar to \LaTeX's \verb|\DeclareTextFontCommand|. For example,
+\verb|\textmc| is redefined by this package as follows:
+    \DeclareFixJFMCJKTextFontCommand\textmc{\mcfamily}
+and \verb|\textgt| is similar.
+Finally, there are several macros that may be useful for \TeX nicians:
+    \FixJFMSpacing
+    \fixjfmparindent
+    \FixJFMParindent
+    \EveryparPreHook
+    \EveryparPostHook
+They are worthless for ordinary use. If you are interested in them, please have
+a look at the source code.
+The \LaTeX-only package \pkg{bxjaprnind} also focuses on the first bug mentioned
+above. It provides some additional functionalities and also supports some other
+\TeX\ engines. This package can be used together with \pkg{bxjaprnind}, but
+please note that if you prefer \pkg{bxjaprnind}, you have to load it before this
+package, and vice versa, in case both of them are loaded.
+The source code of this package is mostly taken from\footnote{This package also
+improves the code slightly.} (in alphabetical order):
+\epTeX\ Wiki (Hironori Kitagawa):
+    https://ja.osdn.net/projects/eptex/wiki/lastnodechar
+\pkg{everyhook} (Stephen Checkoway):
+    https://ctan.org/pkg/everyhook
+\pkg{jsclasses} (Haruhiko Okumura et al.):
+    https://ctan.org/pkg/jsclasses
+and \pkg{platex} (Kazuki Maeda \& Japanese \TeX\ Development Community):
+    https://ctan.org/pkg/platex
+Many thanks to the authors of these packages.

Property changes on: trunk/Master/texmf-dist/doc/generic/fixjfm/fixjfm-doc.tex
Added: svn:eol-style
## -0,0 +1 ##
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/fixjfm/fixjfm.sty
--- trunk/Master/texmf-dist/tex/generic/fixjfm/fixjfm.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/fixjfm/fixjfm.sty	2017-09-02 21:30:30 UTC (rev 45194)
@@ -0,0 +1,193 @@
+% fixjfm.sty
+% Copyright 2017 Yue ZHANG
+% License: Knuth License (https://ctan.org/license/knuth)
+  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
+  \else
+    \ProvidesPackage{fixjfm}[2017/09/02 v0.2 Fix JFM (for *pTeX)]%
+  \fi
+\def\fixjfm at ifprimitive#1{%
+  \begingroup
+    \edef\fixjfm at temp@meaning{\meaning#1}%
+    \edef\fixjfm at temp@string{\string#1}%
+    \expandafter
+  \endgroup
+  \ifx\fixjfm at temp@meaning\fixjfm at temp@string}
+\fixjfm at ifprimitive\tate
+  \errmessage{pTeX / e-pTeX / upTeX / e-upTeX / ApTeX is required}%
+  \expandafter\endinput
+\def\fixjfm at empty{}
+\fixjfm at ifprimitive\quitvmode
+  \let\leavevmode=\quitvmode
+\newif\iffixjfm at lastnodechar@available@
+\fixjfm at ifprimitive\lastnodechar
+  \fixjfm at lastnodechar@available at true
+\iffixjfm at lastnodechar@available@
+  \begingroup
+    \kansujichar1=\sjis"8ABF\relax % U+6F22: Kanji Han
+    \kansujichar2=\sjis"82A0\relax % U+3042: Hiragana A
+    \kansujichar3=\sjis"8142\relax % U+3002: CJK Full Stop
+    \xdef\fixjfm at kanji{\kansuji1}%
+    \xdef\fixjfm at kana{\kansuji2}%
+    \xdef\fixjfm at other{\kansuji3}%
+  \endgroup
+  \def\FixJFMSpacing{\futurelet\fixjfm at sp@temp at token\fixjfm at fixspacing}%
+  \def\fixjfm at fixspacing{%
+    \begingroup
+      \count0=\lastnodechar
+      \edef\fixjfm at sp@temp at tokens{\fixjfm at sp@temp at token}%
+      \expandafter\fixjfm@@fixspacing\fixjfm at sp@temp at tokens\relax\fixjfm at sp@nil
+      \ifnum\count0>-1\relax
+        \setbox0=\hbox{%
+          \inhibitglue\char\count0\relax\fixjfm at sp@temp at token\inhibitglue}%
+        \setbox2=\hbox{%
+          \inhibitglue\char\count0 \fixjfm at sp@temp at token\inhibitglue}%
+        \dimen0=\wd2\relax
+        \advance\dimen0 by -\wd0\relax
+        \fixjfm at temp@hskip\relax
+      \fi
+    \endgroup}%
+  \long\def\fixjfm@@fixspacing#1#2\fixjfm at sp@nil{%
+    \ifcat#1\fixjfm at kanji
+    \else
+      \ifcat#1\fixjfm at kana
+      \else
+        \ifcat#1\fixjfm at other
+        \else
+          \count0=-1\relax
+        \fi
+      \fi
+    \fi}%
+  \def\SetFixJFMSpacingStretch#1{\def\fixjfm at temp@hskip at stretch{#1}}%
+  \def\SetFixJFMSpacingShrink#1{\def\fixjfm at temp@hskip at shrink{#1}}%
+  \def\fixjfm at temp@hskip{%
+    \hskip\dimen0 plus \fixjfm at temp@hskip at stretch
+      minus \fixjfm at temp@hskip at shrink\relax}%
+  \SetFixJFMSpacingStretch{0.05zw}%
+  \SetFixJFMSpacingShrink{0.05zw}%
+  \let\FixJFMSpacing=\fixjfm at empty
+  \def\SetFixJFMSpacingStretch#1{}%
+  \def\SetFixJFMSpacingShrink#1{}%
+  \expandafter\ifx\csname DeclareTextFontCommand\endcsname\relax
+    \def\DeclareFixJFMCJKTextFontCommand#1#2{}%
+    \let\UseFixJFMCJKTextFontCommands=\fixjfm at empty
+    \let\UseStandardCJKTextFontCommands=\fixjfm at empty
+  \else
+    \def\DeclareFixJFMCJKTextFontCommand#1#2{%
+      \DeclareRobustCommand#1[1]{%
+        \relax\ifmmode\nfss at text\fi{#2\fixjfmspacing##1}\fixjfmspacing}}%
+    \def\UseFixJFMCJKTextFontCommands{%
+      \DeclareFixJFMCJKTextFontCommand\textmc{\mcfamily}%
+      \DeclareFixJFMCJKTextFontCommand\textgt{\gtfamily}}%
+    \def\UseStandardCJKTextFontCommands{%
+      \DeclareTextFontCommand\textmc{\mcfamily}%
+      \DeclareTextFontCommand\textgt{\gtfamily}}%
+    \@onlypreamble\DeclareFixJFMCJKTextFontCommand
+    \@onlypreamble\UseFixJFMCJKTextFontCommands
+    \@onlypreamble\UseStandardCJKTextFontCommands
+    \UseFixJFMCJKTextFontCommands
+  \fi
+\fixjfm at ifprimitive\protected
+  \protected\def\<{\ifvmode\leavevmode\fi\inhibitglue}%
+  \def\<{\inhibitglue}%
+  \expandafter\ifx\csname useparheadparenindent\endcsname\relax % bxjaprnind.sty
+  \else
+    \global\let\FixJFMParindent=\fixjfm at empty
+    \global\let\EveryparPreHook=\fixjfm at empty
+    \global\let\EveryparPostHook=\fixjfm at empty
+    \aftergroup\endinput
+  \fi
+  \let\CATCODE=\catcode
+  \let\RELAX=\relax
+  \let\GDEF=\gdef
+  \let\ENDGROUP=\endgroup
+  \GDEF\FIXJFM at KANJICHARACTER{kanji character }%
+\def\FixJFMParindent{\futurelet\fixjfm at pi@temp at token\fixjfm at fixparindent}
+\def\fixjfm at fixparindent{%
+  \expandafter\expandafter\expandafter\fixjfm@@fixparindent
+    \expandafter\meaning\expandafter\fixjfm at pi@temp at token
+    \FIXJFM at KANJICHARACTER\relax\fixjfm at pi@nil}
+  \expandafter#\expandafter1\FIXJFM at KANJICHARACTER#2#3\fixjfm at pi@nil{%
+    \def\fixjfm at pi@temp at tokens{#1}%
+    \ifx\fixjfm at pi@temp at tokens\fixjfm at empty
+      \ifnum\the\inhibitxspcode`#2=2\relax
+        \inhibitglue
+      \fi
+    \fi}
+  \expandafter\ifx\csname PushPostHook\endcsname\relax % everyhook.sty
+    \def\EveryparPreHook{}%
+    \def\EveryparPostHook{\fixjfmparindent}%
+    \let\fixjfm at previous@everypar=\everypar
+    \csname newtoks\expandafter\endcsname\csname everypar\endcsname
+    \let\fixjfm at private@everypar=\everypar
+    \fixjfm at private@everypar=\fixjfm at previous@everypar
+    \fixjfm at previous@everypar={%
+      \EveryparPreHook
+      \the\expandafter\fixjfm at private@everypar
+      \EveryparPostHook}%
+  \else
+    \PushPostHook{par}{\fixjfmparindent}%
+    \let\EveryparPreHook=\fixjfm at empty
+    \let\EveryparPostHook=\fixjfm at empty
+  \fi

Property changes on: trunk/Master/texmf-dist/tex/generic/fixjfm/fixjfm.sty
Added: svn:eol-style
## -0,0 +1 ##
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-09-02 21:29:34 UTC (rev 45193)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-09-02 21:30:30 UTC (rev 45194)
@@ -260,7 +260,7 @@
     fibeamer fifinddo-info fifo-stack fig4latex figbas figbib figflow figsize
     filecontents filecontentsdef filedate filehook fileinfo filemod
     findhyph fink finstrut fira first-latex-doc fitbox fithesis
-    fix2col fixcmex fixfoot fixlatvian fixltxhyph fixme fixmetodonotes
+    fix2col fixcmex fixfoot fixjfm fixlatvian fixltxhyph fixme fixmetodonotes
     flabels flacards flagderiv flashcards flashmovie flipbook flippdf

Modified: trunk/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc
--- trunk/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc	2017-09-02 21:29:34 UTC (rev 45193)
+++ trunk/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc	2017-09-02 21:30:30 UTC (rev 45194)
@@ -16,6 +16,7 @@
 depend cjkutils
 depend dnp
 depend garuda-c90
+depend fixjfm
 depend jfmutil
 depend norasi-c90
 depend pxtatescale

Added: trunk/Master/tlpkg/tlpsrc/fixjfm.tlpsrc

More information about the tex-live-commits mailing list