Home
The LuaTeX-ja package
Contents
1. row col plpgX uplEgX LuaTpX ja row col plpgX uplgX LuaTpX ja U 3000 1 1 N N Y Va U FFOF 1 31 N N Y U 30FB 1 6 N Y N Pa U FF3C 1 32 N N Y i U 309B 1 11 N Y N U FF5C 1 35 N N Y U 309C 1 12 N Y N U FFOB 1 60 N N Y U FF40 1 14 N N Y U FF1D 1 65 N N Y U FF3E 1 16 N N Y C U FF1C 1 67 N N Y U FFE3 1 17 N N Y 2 U FF1E 1 68 N N Y U FF3F 1 18 N N Y U FF03 1 84 N N Y N U 30FD 1 19 N Y Y amp U FF06 1 85 N N X N U 30FE 1 20 N Y Y X U FFOA 1 86 N N Y gt U 309D 1 21 N Y Y U FF20 1 87 N N Y gt U 309E 1 22 N Y Y T U 3012 2 9 N N Y 1 U 3003 1 23 N N Y U 3013 2 14 N N Y A U 4EDD 1 24 N Y Y U FFE2 2 44 N N Y A U 3005 1 25 N N Y U 212B 2 82 N N Y z U 3006 1 26 N N Y Greek letters row 6 Y N Y O U 3007 1 27 N N Y Cyrillic letters row 7 N N Y U 30FC 1 28 N Y Y 5 3 Non kanji Characters in a Control Word Because the engine differ so non kanji JIS X 0208 characters which can be used in a control word differ in pI X in upIEX and in LuaTpX ja Table 5 shows the difference Except for four characters gt gt gt LuaTgX ja admits more characters in a control word than upIgX Note that the ideographic space U 3000 can be
2. U FE30 U FE4F U 20000 U 2FFFF Vertical Forms Small Form Variants Variation Selectors Supplement CJK Compatibility Forms Supplementary Ideographic Plane Table 3 Unicode blocks in predefined character range 7 U 1100 U 11FF Hangul Jamo U 2F00 U 2FDF Kangxi Radicals U 2FFO U 2FFF Ideographic Description Characters U 3100 U 312F Bopomofo U 3130 U 318F Hangul Compatibility Jamo U 31A0 U 31BF Bopomofo Extended U 31C0 U 31EF CJK Strokes U A000 U A48F Yi Syllables U A490 U A4CF U ACOO U D7AF Yi Radicals Hangul Syllables U A830 U A83F U D7BO U D7FF Common Indic Number Forms Hangul Jamo Extended B 4 2 kanjiskip and xkanjiskip JAglue is divided into the following three categories Glues kerns specified in JFM If inhibitglue is issued around a Japanese character this glue will not be inserted at the place The default glue which inserted between two JAchars kanjiskip The default glue which inserted between a JAchar and an ALchar xkanjiskip The value a skip of kanjiskip or xkanjiskip can be changed as the following Note that only their values at the end of a paragraph or a hbox are adopted in the whole paragraph or the whole hbox 1tjsetparameter kanjiskip Opt plus 0 4pt minus 0 4pt xkanjiskip 0 25 zw plus 1pt minus 1pt Here zw is a internal dimension which stores fullwidth of the current Japanese font This zw can be used as the unit zw in pIEX It may occur that JFM contains the
3. kern j kern j kern ratio glue j width stretch shrink priority Cratio Specifies the width of kern or glue which will be inserted between characters in character class i and those in character class j priority is an integer in 2 2 treated as O if omitted and this is used only in line adjustment with priority by luatexja adjust see Subsection 10 3 Higher value means the glue is easy to shretch and is also easy to shrink ratio is also an optional value between 1 and 1 For example Thw width of a glue between an ideographic full stop o and a fullwidth middle dot is three fourth of fullwidth namely halfwidth from the ideographic full stop and quarter width from the fullwidth middle dot In this case we specify ratio to 0 5 0 25 1 054025 0540 25 3 end_stretch kern end_shrink kern MW Character to character classes We explain how the character class of a character is determined using jfm test lua which contains the following 0 Es chars Ex align left left 0 0 down 0 0 width 1 0 height 0 88 depth 0 12 italic 0 0 2000 20 chars E 3 align left left 0 0 down 0 0 width 0 5 height 0 88 depth 0 12 italic 0 0 Now consider the following input output 1 jfont a file KozMinPr6N Regular otf jfm test vert 2 setbox0 hbox a o inhibit
4. 3 1 plain TEX and PTeX 2 Mplain TEX To change Japanese fonts in plain TEX you must use the command jfont So please see Subsection 6 1 WITEX 2 NFSS2 For IMEX 2 LuaTpEX ja adopted most of the font selection system of pIATEX 2 in plfonts dtx Commands fontfamily fontseries fontshape and selectfont can be used to change attributes of Japanese fonts encoding family series shape selection alphabetic fonts romanencoding romanfamily romanseries romanshape useroman Japanese fonts kanjiencoding kanjifamily kanjiseries kanjishape usekanji both fontseries font shape auto select fontencoding fontfamily usefont fontencoding encoding changes the encoding of alphabetic fonts or Japanese fonts depending on the argument For example fontencoding JY3 changes the encoding of Japanese fonts to JY3 and fontencoding T1 changes the encoding of alphabetic fonts to T1 fontfamily also changes the current Japanese font family the current alphabetic font family or both For the detail see Subsection 9 1 For defining a Japanese font family use DeclareKanjiFamily instead of DeclareFontFamily However in the present implementation using NDeclareFontFamily doesn t cause any problem Defining a Japanese font shape can be done by usual DeclareFontShape DeclareFontShape JY3 mc bx n lt gt s KozMinPr6N Bold jfm ujis kern Kozuka Mincho Pr6N Bold Noe w Rh ou Ne
5. It is not strange that 25 does not printed in the above output This is because TEX Gyre Termes does not contain 25 and because 25 in line 3 is considered as an ALchar 66 99 Note that there is no space before y in the output but there is a space before u This follows from following reasons e When line 3 is processed by process_input_buffer callback dS is considered as an JAchar Since line 3 ends with an JAchar the comment character U FFFFF is appended to this line and hence the linebreak immediately after this line is ignored e When line 4 is processed by process input buffer callback Ll is considered as an ALchar Since line 4 ends with an ALchar the linebreak immediately after this line emits a space 7Usually it is return whose character code is 13 36 13 Patch for the listings Package It is well known that the listings package outputs weird results for Japanese input The listings package makes most of letters active and assigns output command for each letter 2 But Japanese characters are not included in these activated letters For pIEX series there is no method to make Japanese characters active a patch jlisting sty 4 resolves the problem forcibly In LuaTEX ja the problem is resolved by using the process input buffer callback The callback function inserts the output command active character U FFFFF before each letter above U 0080 This method can omits the
6. Section Sign U 00B4 Spacing acute e U 00A8 Diaeresis f U 00B6 Paragraph sign e U 00B0 Degree sign X U 00D7 Multiplication sign e U 00B1 Plus minus sign e U 00F7 Division Sign Range 1 Latin characters that some of them are included in Adobe Japan1 6 This range consists of the following Unicode ranges except characters in the range 8 above e U 0080 U 00FF Latin 1 Supplement e U 0300 U 036F U 0100 U 017F Latin Extended A Combining Diacritical Marks e U 0180 U 024F Latin Extended B e U 1E00 U 1EFF U 0250 U 02AF IPA Extensions Latin Extended Additional e U 02B0 U 02FF Spacing Modifier Letters Range 2 Greek and Cyrillic letters JIS X 0208 hence most of Japanese fonts has some of these characters e U 0370 U 03FF Greek and Coptic e U 1FO0 U 1FFF Greek Extended U 0400 U 04FF Cyrillic Range 3 Punctuations and Miscellaneous symbols The block list is indicated in Table 1 Range 4 Characters usually not in Japanese fonts This range consists of almost all Unicode blocks which are not in other predefined ranges Hence instead of showing the block list we put the definition of this range itself lt jdef charrange 4 500 10FF 1200 1DFF 2440 245F 27CO 28FF 2A00 2AFF 2C00 2E7F 4DCO 4DFF A4D0 A82F A840 ABFF FBOO FEOF FE20 FE2F FE70 FEFF 10000 1FFFF E000 F8FF non Japanese Range 5 Surrogates and Supplementary Private Use Areas Range 6 C
7. We didn t taken account of when both 90jis and jis2004 are specified MPresets for multi weight Besides morisawa pro and morisawa pr6n presets fonts are specified by fontname not by filename kozuka pro Kozuka Pro Adobe Japan1 4 fonts kozuka pr6 Kozuka Pr6 Adobe Japan1 6 fonts kozuka pr6n Kozuka Pr6N Adobe Japan1 6 JISO4 savvy fonts Kozuka Pro Pr6N fonts are bundled with Adobe s software such as Adobe InDesign There is not rounded gothic family in Kozuka fonts family series kozuka pro kozuka pr6 kozuka pr6n da medium KozMinPro Regular KozMinProVI Regular KozMinPr6N Regular bold KozMinPro Bold KozMinProVI Bold KozMinPr6N Bold da KozGoPro Regular KozGoProVI Regular KozGoPr6N Regular KozGoPro Medium KozGoProVI Medium KozGoPr6N Medium gothic bold KozGoPro Bold KozGoProVI Bold KozGoPr6N Bold heavy KozGoPro Heavy KozGoProVI Heavy KozGoPr6N Heavy rounded gothic KozGoPro Heavy KozGoProVI Heavy KozGoPr6N Heavy In above table starred fonts KozGo Regular are used for medium series of gothic if and only if deluze option is specified ino pro Hiragino Pro Adobe Japan1 5 fonts Provided by mgfamily and textmg because rounded gothic is called maru gothic LFV Y 7 in Japanese 9 hiragino pron Hiragino ProN Adobe Japan1 5 JISO4 savvy fonts Hiragino fonts are bundled with Mac OS X 10 5 or later Some editions of a Japanese word processor KES 2012 includes Hiragino ProN fonts Note
8. df When a character whose category code is 0 escape character is seen by TEX the input processor scans a control sequence scan a c s These paths are not shown in the above diagram After that the state is changed to State S skipping blanks in most cases but to State M middle of line some times Figure 8 State transitions of pIEX s input processor However token filter callback cannot be used either since a character in category code 5 end of line is converted into an space token in the input processor So we canuse only the process input buffer callback This means that suppressing a space must be done just before an input line is read Considering these situations handling of an end of line in LuaTpX ja are as follows A character U FFFFF its category code is set to 14 comment by Lua TpX ja is appended to an input line before LuaT X actually process it if and only if the following three conditions are satisfied 1 The category code of endlinechar is 5 end of line 2 The category code of U FFFFF itself is 14 comment 3 The input line matches the following regular expression any char JAchar catcode 1 U catcode 2 MRemark The following example shows the major difference from the behavior of pIEX fontspec Ligatures TeX TeX Gyre Termes 1tjsetparameter autoxspacing false lt jsetparameter jacharrange 6 x amp yMtjsetparameter jacharrange 6 zl u xyzv u
9. Japanese punctuation mark kcatcode chr_code natural number An additional attributes which each character whose char acter code is chr_code has At the present version the lowermost bit of natural number indi cates whether the character is considered as a punctuation mark see the description of jcharwid owpenalty above prebreakpenalty chr_code penalty prebreakpenalty Set a penalty which is inserted auto matically before the character chr_code to prevent a line starts from this character For example a line cannot started with one of closing brackets so Lua TEX ja sets Mtjsetparameter prebreakpenalty 0J 10000 by default postbreakpenalty chr_code penalty postbreakpenalty Set a penalty which is inserted au tomatically after the character chr code to prevent a line ends with this character pIEX has following restrictions on prebreakpenalty and Npostbreakpenalty but they don t exist in LuaTpX ja Both prebreakpenalty and Npostbreakpenalty cannot be set for the same character We can set prebreakpenalty and postbreakpenalty up to 256 characters jatextfont jfam jfont_cs textfont in TEX jascriptfont jfam jfont_cs Nscriptfont in TEX jascriptscripttont jfam jfont_cs Nscriptscriptfont in TEX yjabaselineshift dimen yalbaselineshift dimen Nybaselineshift jaxspmode chr_code mode Y Setting whether inserting xkanjiskip is
10. The distinction between ALchar and JAchar is done for character ranges This can be edited by setting the jacharrange parameter For example this is just the default setting of Lua TpX ja and it sets 11 acharacter which belongs character ranges 1 4 and 5 is ALchar acharacter which belongs character ranges 2 3 6 7 and 8 is JAchar Mtjsetparameter jacharrange 1 2 3 4 5 6 7 8 The argument to jacharrange parameter is a list of non zero integer Negative integer n in the list means that each character in the range n is an ALchar and positive integer n meansthat is a JAchar M Default setting LuaTEX ja predefines eight character ranges for convenience They are determined from the following data Blocks in Unicode 6 0 e The Adobe Japan1 UCS2 mapping between a CID Adobe Japan1 6 and Unicode e The PXbase bundle for upIEX by Takayuki Yato Now we describe these eight ranges The superscript J or A after the number shows whether each character in the range is treated as JAchars or not by default These settings are similar to the prefercjk settings defined in PXbase bundle Any characters above U 0080 which does not belong to these eight ranges belongs to the character range 217 Range 8 The intersection of the upper half of ISO 8859 1 Latin 1 Supplement and JIS X 0208 a basic character set for Japanese This character range consists of the following characters U 00A7
11. character is ignored and doesn t yield a space since line breaks in source files are permitted almost everywhere in Japanese texts However Lua TEX ja doesn t have this function completely because of a specification of LuaTpX The insertion process of glues kerns between two Japanese characters and between a Japanese char acter and other characters we refer glues kerns of both kinds as JAglue is rewritten from scratch As LuaTEX s internal ligature handling is node based e g of T fice doesn t prevent liga tures the insertion process of JAglue is now node based Furthermore nodes between two characters which have no effects in line break e g Nspecial node and kerns from italic correction are ignored in the insertion process Caution due to above two points many methods which did for the dividing the process of the in sertion of JAglue in pI X are not effective anymore In concrete terms the following two methods are not effective anymore DIFE BEWVDE If you want to do so please put an empty horizontal box hbox between it instead E amp Nhbox 2 amp In the process two Japanese fonts which only differ in their real fonts are identified e At the present vertical typesetting tategaki is not supported in Lua TEX ja For detailed information see Part III 1 3 Notations In this document the following terms and notations are used Characters are classified into foll
12. characters which is in Adobe Japan1 6 CID but not in JIS X 0208 Since this package is widely used LuaTpX ja sup ports some of functions in japanese otf package If you want to use these functions load luatexja otf package jfontspec KozMinPr6N Regular otf R UTF 9DD7 5 amp AA UTF 9592 amp D UTF 9AD9 EBIC TK PE CAM ARIE DS EC fT amp o NCID 7652 8f X O CID 13706 FR BBRpCO SEX SWH EA gud cdd CID 1481 R 5 E paar hd went Bll amp CID 8705 UTF FA11 aj FALISAD lt AZATYI 4 Changing Parameters There are many parameters in LuaTEX ja And due to the behavior of LuaTEX most of them are not stored as internal register of TEX but as an original storage system in LuaTpX ja Hence to assign or acquire those parameters you have to use commands 1t jsetparameter and ltjgetparameter 4 1 Editing the Range of JAchars LuaTpX ja divides the Unicode codespace U 0080 U 10FFFF into character ranges numbered 1 to 217 The grouping can be globally customized by 1tjdef charrange The next line adds whole characters in Supplementary Ideographic Plane and the character 1 to the character range 100 lt jdef charrange 100 20000 2FFFF 23 A character can belong to only one character range For example whole SIP belong to the range 4 in the default setting of Lua TpX ja and if you execute the above line then SIP will belong to the range 100 and be removed from the range 4
13. data of ideal width of kanjiskip and or ideal width of xkanjiskip To use these data from JFM set the value of kanjiskip or xkanjiskip to maxdimen 4 3 Insertion Setting of xkanjiskip Itis not desirable that xkanjiskip is inserted into every boundary between JAchars and ALchars For exam ple xkanjiskip should not be inserted after opening parenthesis e g compare 35 and 45 LuaTEX ja can control whether xkanjiskip can be inserted before after a character by changing jaxspmode for JAchars and alxspmode parameters ALchars respectively 13 N N N w u o EI oo o lt jsetparameter jaxspmode preonly alxspmode postonly p Hq 9 pq U 2 The second argument preonly means that the insertion of xkanjiskip is allowed before this character but not after the other possible values are postonly allow and inhibit jaxspmode and alxspmode use a same table to store the parameters on the current version Therefore line 1 in the code above can be rewritten as follows lt jsetparameter alxspmode preonly jaxspmode postonly One can use also numbers to specify these two parameters see Subsection 7 1 If you want to enable disable all insertions of kanjiskip and xkanjiskip set autospacing and autoxspac ing parameters to true false respectively 4 4 Shifting the baseline To make a match between a Japanese font and an alphabetic font sometimes shifting of the base
14. directory Using in plain Tex To use LuaTpX ja in plain TEX simply put the following at the beginning of the document input luatexja sty This does minimal settings like ptex tex for typesetting Japanese documents 2 4 The following 6 Japanese fonts are preloaded classification font name 10 pt 7 pt 5 pt mincho Ryumin Light tenmin Nsevenmin fivemin gothic GothicBBB Medium tengt sevengt fivegt It is widely accepted that fonts Ryumin Light and GothicBBB Medium aren t embedded into PDF files and a PDF reader substitute them by some external Japanese fonts e g Ryumin Light is substituted with Kozuka Mincho in Adobe Reader We adopt this custom to the default setting A character in an alphabetic font is generally smaller than a Japanese font in the same size So actual size specification of these Japanese fonts is in fact smaller than that of alphabetic fonts namely scaled by 0 962216 The amount of glue that are inserted between a JAchar and an ALchar the parameter xkanjiskip is set to 0 25 0 962216 10 pt 2 40554 pt P 1 pt 1 pt Using in BIEX BIPIEpX2 Using in IATEX 2 is basically same To set up the minimal environment for Japanese you only have to load 1uatexja sty usepackage luatexja It also does minimal settings counterparts in plATEX are plfonts dtx and pldefs 1tx JY3 is the font encoding for Japanese fonts in horizontal direction When ver
15. global command is needed before these two commands to reflect TEX s in ternal parameter globaldefs 1tj setpar global ltjsetkanjiskip Opt plus 1 zw minus 01 zw Mtjsetxkanjiskip 0 25em plus 0 15em minus 0 06em and Mtjsetparemetert kanjiskip 0pt plus 1 zw minus 01 zw xkanjiskip 0 25em plus 0 15em minus 0 06em have the same meaning 8 Other Commands for plain TEX and BIFX 24 8 1 Commands for Compatibility with pIpx The following commands are implemented for compatibility with pIEX Note that the former five commands don t support JIS X 0213 but only JIS X 0208 The last kansuji converts an integer into its Chinese numerals kuten jis euc sjis jis kansuji These six commands takes an internal integer and returns a string newcount hoge hoge 2423 9251 JL H the hoge kansuji hoge 12355 y jis hoge char jis hoge s Nkansujii701 To change characters of Chinese numerals for each digit set kansujichar parameter lt jsetparameter kansujichar 1 lt jsetparameter kansujichar 7 EH lt jsetparameter kansujichar 0 Ey kansuji1701 RES EXPE 8 2 Ninhibitglue inhibitglue suppresses the insertion of JAglue The following is an example using a special JFM that there will be a glue between the beginning of a box and 25 and also between 25 and 7 26 DA Ro N jfont g file KozMinPr6N Regular otf jfm test g fbox hbox 7H inh
16. m min lua Example 116 4499999 9999999 9999999 HSAEESS panten l pon Eo ADB UY CER ALDMSTEUY CHR ALANS HUY CR Flo TE Hilo CE Filio TUE EU a ice a LAE Example 2 Bro ay BkEveE ff BkDE ld Bounding Box Vex 1tjsetparameter differentjfm both jfont F file KozMinPr6N Regular otf jfm ujis jfont G file KozGoPr6N Medium otf jfm ujis jfont H file KozGoPr6N Medium otf jfm ujis jfmvar hoge VE 4 G gt halfwidth space ODO eH 1 fullwidth space GU EIFI EU UG ES EU 317 Oe TIRIF 1319 Npar 314 QuE MEI 1317 pTeX like 1tjsetparameter differentjfm paverage Figure 1 Example of jfmvar key j m ujis lua A standard JFM in LuaTpX ja This JFM is based on upnmlminr h tfm a metric for UTF OTF package that is used in upIgX When you use the luatexja otf package you should use this JFM j m jis lua A counterpart for jis tfm JIS font metric which is widely used in pIEX A major difference between jfm ujis lua and this jfm jis lua is that most characters under jfm ujis lua are square shaped while that under jfm jis lua are horizontal rectangles j m min lua A counterpart for min10 tfm which is one of the default Japanese font metric shipped with pIEX The difference among these three JFMs is shown in Table 6 jfmvar string Sometimes there is a need that lllUsing kerning information in a font Some fonts have information for inter glyph spacing This version
17. of LuaTpX ja treats kerning spaces like an italic correction any glue and or kern from the JFM and a kerning space can coexist See Figure 2 for detail Note that in setmainjfont etc which are provided by luatexja fontspec package kerning option is set off Kerning 0ff by default because of the compatibility with previous versions of LuaTpX ja Mextend and slant The following setting can be specified as OpenType font features extend extend expand the font horizontally by extend slant slant slant the font Note that Lua TEX ja doesn t adjust JFMs by these extend and slant settings you have to write new JFMs on purpose For example the following example uses the standard JFM jfm ujis lua hence letter spacing and the width of italic correction are not correct 17 BAFRY ARTI AFERRA RAF SIR 7 x RAF Ss VIRAIZ 11 1 111 J11 SX 1 newcommand test vrule 4 tiv 724 7 Y vrule 2 jfont KMFW KozMinPr6N Regular jfm prop kern at 17pt 3 jfont KMFK KozMinPr6N Regular jfm prop at 17pt kern is activated 4 jfont KMPW KozMinPr6N Regular jfm prop script df1t pwid kern at 17pt 5 jfont KMPK KozMinPr6N Regular jfm prop script dflt pwid kern at 17pt 6 begin multicols 2 7 ltjsetparameter kanjiskip Opt s KMFW test KMFK test KMPW test KMPK test 9 10 ltjsetparameter kanjiskip 3pt u KMFW test KMFK test KMPW test KMPK test 2 end multicols Figure 2 Kerning information and kan
18. process to make all Japanese characters active most of the activated characters are not used in many cases If the listings package and LuaTpEX ja were loaded then the patch 11t jp listings is loaded auto matically at begin document 13 1 Notes MEscaping to IXI EX We used the process_input_buffer callback to output JAchars But it has a drawback any commands whose name contains a JAchar cannot be used in any escape to IEX Consider the following input begin lstlisting lescapechar NEU Ux Od end 1lstlisting The line 2 is transformed by the callback to NE NA OTE ke before the line is actually processed In the escape between the character the category code of U FFFFF is set to 9 ignored Hence the control symbol MEE will be executed instead of lKl7 13 2 Class of Characters Roughly speaking the listings package processes input as follows 1 Collects letters and digits which can be used for the name of identifiers 2 When reading an other outputs the collected character string with modification if needed 3 Collects others 4 When reading a letter or a digit outputs the collected character string 5 Turns back to 1 By the above process line breaks inside of an identifier are blocked A flag lst ifletter indicates whether the previous character can be used for the name of identifiers or not For Japanese characters line breaks ar
19. shipout hook HO v3 4 Data extraction from label references HO v1 7 Color options for hyperref bookmark HO v1 3 Hooks for auxiliary files HO v3 11 Key value format for package options HO ver 3 4 Verb mode for urls etc v1 7 Rerun checks for auxiliary files HO v1 24 PDF bookmarks HO v2 20 fontspec support of LuaTeX ja v5105 LaTeX2e option processing using LaTeX3 keys v5105 L3 programming layer loader v2 4 Font selection for XeLaTeX and LuaLaTeX v5105 L3 Experimental document command parser v2 4 Font selection for XeLaTeX and LuaLaTeX v1 1q fixes to LaTeX v2 4 Font selection for XeLaTeX and LuaLaTeX v0 981 provides access to latin accents and many other characters lower plane fontspec support of LuaTeX ja Japanese font presets vO 7e Unicode maths in XeLaTeX and LuaLaTeX v1 6 Catch the contents of a file HO vi 1q fixes to LaTeX vO 5d Hooks for input files 42 lualatex math sty etoolbox sty metalogo sty 11tjp fontspec sty 11tjp xunicode sty lltjp unicode math sty lltjp listings sty epstopdf base sty grfext sty nameref sty gettitlestring sty 2014 06 18 2011 01 03 2010 05 29 2013 05 14 2013 05 14 2013 05 14 2014 01 09 2010 02 09 2010 08 19 2012 10 27 2010 12 03 vi 3a Patches for mathematics typesetting with LuaLaTeX v2 1 e TeX tools for LaTeX v0 12 Extended TeX logo macros Patch to fontspec for LuaTeX ja Patch to xunicode for LuaTeX ja Patch to unicode math for LuaTeX ja Pat
20. u MRemark Japanese characters in math mode Since pIEX supports Japanese characters in math mode there are sources like the following 1 E8 f Ntext high temperature Festa Tigh temperature NE y x 1 72 2Xquad KD CNquad y gt 0 NM E 2 5 in p in mathbb N text p is a y x 1 2 oT y gt 0 ponent 5 R peEN pisaprime We the project members of LuaTpX ja think that using Japanese characters in math mode are allowed if and only if these are used as identifiers In this point of view The lines 1 and 2 above are not correct since iil in above is used as a textual label and K o T is used as a conjunction However the line 3 is correct since 3 amp is used as an identifier Hence in our opinion the above input should be corrected as f Next ia im _ textf high temperature NE y x 1 72 2 quad mathrel text k 2 C quad y 0 M 5 in 3k amp MN pMinWaathbb N text p is a arios iS SEX pEN pisa prime fim Cf hign tempe at re y x 1 4 2 KT y gt 0 We also believe that using Japanese characters as identifiers is rare hence we don t describe how to change Japanese fonts in math mode in this chapter For the method please see Subsection 6 4 3 2 fontspec To coexist with the fontspec package it is needed to load luatexja fontspec package in the preamble as follows usepackage options luatexja fontspec This luatexja fontspec package autom
21. used in a control word in LuaTEX ja Difference becomes larger if we consider non kanji JIS X 0213 characters For the detail see https github com h kitagawa kct 6 Font Metric and Japanese Font 6 1 jfont To load a font as a Japanese font you must use the V j font instead of font while jfont admits the same syntax used in font LuaTpX ja automatically loads luaotfload package so TrueType OpenType fonts with features can be used for Japanese fonts jfont tradgt file KozMinPr6N Regular otf script latn trad kern jfm ujis at 14pt eS 8 BY tradgt XR BR N w Note that the defined control sequence tradgt in the example above using jfont is not a font_def token but a macro Hence the input like fontname tradgt causes a error We denote control sequences which are defined in jfont by jfont cs MJFM As noted in Introduction a JFM has measurements of characters and glues kerns that are auto matically inserted for Japanese typesetting The structure of JFM will be described in the next subsection At the calling of jfont you must specify which JFM will be used for this font by the following keys jfm name Specify the name of JFM If specified JFM has not been loaded LuaTpEX ja search and load a file named jf m name 1ua The following JFMs are shipped with LuaTEX ja 16 1 2 3 4 5 6 7 8 9 10 11 Table 6 Differences between JFMs shipped with LuaTEX ja jfm ujis lua j m jis lua j
22. 0 2011 06 30 2011 10 05 2011 10 16 2011 01 30 2011 03 04 2011 06 30 2013 09 16 2011 04 15 2011 12 02 2004 08 06 2013 05 14 2013 05 14 2014 06 19 2014 06 10 2014 06 10 2014 06 01 2014 06 10 2014 06 01 2014 05 13 2014 06 01 2011 09 09 in Unicode luatexja fontspec 24 sty 2014 06 19 luatexja preset sty unicode math sty catchfile sty fix cm sty filehook sty unicode math luatex sty 2013 10 28 2013 05 04 2011 03 01 2014 05 13 2011 10 12 vO 2z Improved picture commands HjG RN JT vi 3d Float enhancements AL v1 61803 publication quality tables vi 8e multicolumn formatting FMi v0 21 1 5c Carsten Heinz 1 5c Carsten Heinz v0 31 Typesetting example code RN v4 3 Infix arithmetic KKT FJ vi ic Standard LaTeX ifthen package DPC ver 0 92 v6 83m Hypertext links for LaTeX v1 13 Bundle oberdiek subset hyperref HO v1 13 Bundle oberdiek subset generic HO Variable width minipages v1 13 Construct package bundles HO v1 1 Expandable calculations with integers HO v1 5 Avoid name clashes with e TeX commands HO v1 16 Key value parser HO vi 3 Define keys HO v1 13 Implements pdfTeX s escape features HO v1 3 Expandable calculations on big integers HO v1 1 Handle bit vector datatype HO vi 2 Provide unlimited unique counter HO v1 4 Let assignment for LaTeX macros HO v1 2 Wrapper for package hooks HO xcolor patch v1 8 Hooks at the very end of document HO v1 16 At begin
23. Force ed Requirements for Japanese Text Layout W3C Working Group 6 7 Note 2011 2012 http www w3 org TR jlreq CBR O minl0Z7z7Hhicovc http argent shinshu u ac jp otobe tex files min10 pdf for Japanese documents 1993 1995 2004 WTHR Japanese Industrial Standard JIS X 4051 40 HAGA CHO MATE Formatting rules A Package versions used in this document This document was typeset using the following packages geometry sty 2010 09 12 v5 6 Page Geometry keyval sty 2014 05 08 v1 15 key value parser DPC ifpdf sty 2011 01 30 v2 3 Provides the ifpdf switch HO ifvtex sty 2010 03 01 v1 5 Detect VTeX and its facilities HO ifxetex sty 2010 09 12 v0 6 Provides ifxetex conditional luatexja adjust sty 2013 05 14 luatexja sty 2013 05 14 Japanese Typesetting with LuaTeX luatexja core sty 2014 02 01 Core of LuaTeX ja luaotfload sty 2014 05 18 v2 4 4 OpenType layout system luatexbase sty 2013 05 11 v0 6 Resource management for the LuaTeX macro programmer ifluatex sty 2010 03 01 v1 3 Provides the ifluatex switch HO luatex sty 2010 03 09 v0 4 LuaTeX basic definition package HO infwarerr sty 2010 04 08 v1 3 Providing info warning error messages HO etex sty 1998 03 26 v2 0 eTeX basic definition package PEB luatex loader sty 2010 03 09 v0 4 Lua module loader HO luatexbase compat sty 2011 05 24 v0 4 Compatibility tools for LuaTeX luatexbase modutils sty 2013 05 11 v0 6 Module util
24. The LuaTpEX ja package The LuaTpX ja project team June 21 2014 Contents I II User s manual Introduction Ly Spek uou sm tok ees 9o x Y NOE CeURC NOR ERA IUE NO E veu ede BUS RUE RS L2 Major Changes rom lp eros a ee eee S LS Notons 2 25 goo no kg Sha 9ox X Ro EGA no cR C RU CASAS ewe eS ld Abov the Projeti 2224 ro e ee RARE Ae de REE Bard OS Getting Started FAM OUI n AP TT a ev PC ee ba oe a TT 23 Usine in plain TEX ooo comio retata be A ee a A a eo o ge oe 9 dome 33 ee De Re ee we Pa ee eee ae oe Changing Fonts Sel qii Ves ARES Za o ee tries RDA wa RE ee A EE SS E S 35 AORBESHEE a BAER ae ee GR ee Oe A ee E RURUEOE i Do PUN MP Sea hee ee A e ee OA ee hee ee 4 3 4 CID UTF and macros in japanese otf package o o Changing Parameters 4 1 Editing the Range of JAchars e 42 kanjiskip and xkanjiskipD sco cee ee bee RR eee ee eee 4 3 Insertion Setting of xkanjisip ees 44 Sfinge the baseline lt lt oo oko 500445 de EORR Rom ba oe a eae Reference catcode in LuaTgx ja 5 1 Preliminaries kcatcode in pIEX anduplEX 2 2 eee A2 Case Ol LUAaTR AJA ce ee Ro k kpaa ey Ron ERAS GS ERO Rew ee 5 3 Non kanji Characters in a Control Word o 0 002000000 Font Metric and Japanese Font Ol MESE 2 04x a ts ERA 6 2 rens palt s sey he te A 6 3 Structure of a JFM File 64 Math Font Family Do Callbacks ss gc a a Pa
25. allowed before after a JAchar whose character code is chr_code The followings are allowed for mode 0 inhibit Insertion of xkanjiskip is inhibited before the character nor after the character 1 preonly Insertion of xkanjiskip is allowed before the character but not after 2 postonly Insertion of xkanjiskip is allowed after the character but not before 3 allow Insertion of xkanjiskip is allowed both before the character and after the character This is the default value This parameter is similar to the inhibitxspcode primitive of pIEX but not compatible with inhibitxspcode alxspmode 4 chr_code mode Nxspcode Setting whether inserting xkanjiskip is allowed before after a ALchar whose character code is chr code The followings are allowed for mode 0 inhibit Insertion of xkanjiskip is inhibited before the character nor after the character 1 preonly Insertion of xkanjiskip is allowed before the character but not after 2 postonly Insertion of xkanjiskip is allowed after the character but not before 3 allow Insertion of xkanjiskip is allowed before the character and after the character This is the default value 24 Note that parameters jaxspmode and alxspmode share a common table hence these two parameters are synonyms of each other autospacing bool autospacing autoxspacing bool autoxspacing kanjiskip skip kanjiskip xkanjiskip skip xkanjiskip differentjfm mode Spec
26. aracter in the JFM will be stored in this field as chars character i char type For i c char_typeli is information of characters whose class is i and has the following fields width height depth italic down left are just scaled value of those specified by the JEM by the font size e align is a number which is determined from align field in the JFM 0 left and the default value 0 5 middle 1 right For j j stores a kern or a glue which will be inserted between character class i and class j If a kern will be inserted the value of this field is 7 false kern node ratio where kern node is anode If a glue will be inserted we have j false spec node ratio icflag Y where spec_node is also a node and icflag from jfm priority This version of LuaTpX ja uses direct access model for accessing nodes if possible 22 The returned table new_jfont_info also should include these fields but you are free to add more fields to use them in the luatexja find char class callback The font number is a font num ber A good example of this and the next callbacks is the luatexja otf package supporting AJ1 xxx form for Adobe Japan1 CID characters in a JFM This callback doesn t replace any code of LuaTpX ja luatexja find char class callback This callback is called just when LuaTpX ja is trying to determine which character class a character chr code b
27. arify the difference between pIEX and LuaTpx We briefly describe the handling of a line break in pIpX in this subsection pIEX s input processor can be described in terms of a finite state automaton as that of TEX in Section 2 5 of 1 The internal states are as follows State N new line e State S skipping spaces State M middle of line State K after a Japanese character The first three states N S and M are as same as TpX s input processor State K is similar to state M and is entered after Japanese characters The diagram of state transitions are indicated in Figure 8 Note that pIEX doesn t leave state K after beginning ending of a group characters 12 2 Behavior in LuaT X ja States in the input processor of LuaTpxX is the same as that of TEX and they can t be customized by any callbacks Hence we can only use process input buffer and token filter callbacks for to suppress a space by a line break which is after Japanese characters 35 scan a c s 5 par start G Beginning of group usually and ending of group usually J Japanese characters 5 end of line usually J 10 space usually O other characters whose category code is in 3 4 6 7 8 11 12 13 u par emits a space or par We omitted about category codes 9 ignored 14 comment and 15 invalid from the above diagram We also ignored the input like A or
28. atexja base where filename stands for the filename without suffix save cache filename data Save a non nil table data into a cache filename Both the text form filename lua and its binary version are created or updated save cache luc filename data serialized data Same as save cache except that only the binary cache is updated The third argument serial ized data is not usually given But if this is given it is treated as a string representation of data load cache filename outdate Load the cache filename outdate is a function which takes one argument the contents of the cache and its return value is whether the cache is outdated load cache first tries to read the binary cache filename 1uc 1ub If its contents is up to date load cache returns the contents If the binary cache is not found or its contents is outdated 1oad cache tries to read the text form filename 1ua Hence the return value of 1oad cache is non nil if and only if the updated cache is found References 1 Victor Eijkhout 7EX by Topic A TgXnician s Reference Addison Wesley 1992 2 C Heinz B Moses The Listings Package 3 Takuji Tanaka upTeX Unicode version of pTeX with CJK extensions TUG 2013 October 2013 http tug org tug2013 slides TUG2013 upTeX pdf 39 4 Thor Watanabe Listings MyTeXpert Listings http mytexpert sourceforge jp index php 5 W3C Japanese Layout Task
29. atexja isglobal global 382 else directlua luatexja isglobal fi 383 334 protected def M t jsetparameter 1 35 ltj setpar global setkeys 1tj japaram 1 ignorespaces 386 protected def Mt jglobalsetparameteriti 37 relax ifnum globaldefs lt 0 directlua luatexja isglobal 388 VelseMdirectlua luatexja isglobal global JMfi 39 setkeys 1tj japaram 1 ignorespaces Figure 7 Definiton of parameter setting commands MSetting parameters Figure 7 shows the most outer definition of two commands 1t jsetparameter and lt jglobalsetparameter Most important part is the last setkeys which is offered by the xkeyval package Hence to add a key in 1tj setparameter one only have to add a key whose prefix is 1tj and whose family is japaram as the following define key 1tj japaram Mtjsetparameter and ltjglobalsetparameter automatically sets luatexja isglobal Its mean ing is the following global global t local luatexja isglobal 1 This is determined not only by command name Mt jsetparameter or M tjglobalsetparameter but also by the value of globaldefs 12 Linebreak after a Japanese Character 12 1 Reference Behavior in pIEX In pIEX a line break after a Japanese character doesn t emit a space since words are not separated by spaces in Japanese writings However this feature isn t fully implemented in LuaTpX ja due to the specification of callbacks in Lua TEX To cl
30. atically loads luatexja and fontspec package if needed In luatexja fontspec package the following seven commands are defined as counterparts of original commands in the fontspec package Japanese fonts jfontspec setmainjfont setsansjfont setmonojfont alphabetic fonts fontspec setmainfont setsansfont setmonofont Japanese fonts newjfontfamily newjfontface defaultjfontfeatures addjfontfeatures alphabetic fonts newfontfamily newfontface defaultfontfeatures addfontfeatures The package option of luatexja fontspec are the followings match If this option is specified usual family changing commands such as rmfamily textrm sffamily also change Japanese font family Note that Nsetmono j font is defined if and only if this match option is specified pass opts Specify options opts which will be passed to the fontspec package The reason that setmonojfont is not defined by default is that it is popular for Japanese fonts that nearly all Japanese glyphs have same widths Also note that kerning information in a font is not used that is kern feature is set off by default in these seven or eight commands This is because of the compatibility with previous versions of LuaTpX ja see 6 1 fontspec Numbers 01dStyle LMSans10 Regular jfontspec CJKShape NLC KozMinPr6N Regular JIS X 0213 200434 JIS X 0213 2004 gt it JIS X 0208 1990 ik jfontspec CJKShape JIS1990 KozMinPr6N Regular JIS X 0208 1990
31. back function and so on as other callbacks luatexja load_jfm callback With this callback you can overwrite JFMs This callback is called when a new JFM is loaded function lt table gt jfm info lt string gt jfm_name 2 return lt table gt new jfm info 3 end The argument jfm_info contains a table similar to the table in a JFM file except this argument has chars field which contains character codes whose character class is not 0 An example of this callback is the 1t jarticle class with forcefully assigning character class 0 to parbdd in the JFM jfm min lua luatexja define_jfont callback This callback and the next callback form a pair and you can assign characters which do not have fixed code points in Unicode to non zero character classes This luatexja define_jfont callback is called just when new Japanese font is loaded function lt table gt jfont info lt number gt font number 2 return lt table gt new jfont info 3 end jfont info has the following fields which may not overwritten by a user size The font size specified at jfont in scaled points 1 sp 27 pt ZW zh kanjiskip xkanjiskip These are scaled value of those specified by the JFM by the font size j m The internal number of the JFM var The value of jfmvar key which is specified at jfont The default value is the empty string chars The mapping table from character codes to its character classes The specification i chars ch
32. ch to listings for LuaTeX ja v2 5 Base part for package epstopdf v1 1 Manage graphics extensions HO v2 43 Cross referencing by name of section v1 4 Cleanup title references HO 43
33. cs DPC SPQR graphics sty 2009 02 05 vi 0o Standard LaTeX Graphics DPC SPQR trig sty 1999 03 16 v1 09 sin cos tan DPC pgfsys sty 2013 11 30 v3 0 0 rcs revision 1 47 xcolor sty 2007 01 21 v2 11 LaTeX color extensions UK pgfcomp version 0 65 sty 2007 07 03 v3 0 0 rcs revision 1 7 pgfcomp version 1 18 sty 2007 07 23 v3 0 0 rcs revision 1 1 pgffor sty 2013 12 13 v3 0 0 rcs revision 1 25 pgfkeys sty pgfmath sty 41 pict2e sty multienum sty float sty booktabs sty multicol sty luatexja ruby sty listings sty lstmisc sty Showexpl sty calc sty ifthen sty varwidth sty hyperref sty hobsub hyperref sty hobsub generic sty hobsub sty intcalc sty etexcmds sty kvsetkeys sty kvdefinekeys sty pdfescape sty bigintcalc sty bitset sty uniquecounter sty letltxmacro sty hopatch sty xcolor patch sty atveryend sty atbegshi sty refcount sty hycolor sty auxhook sty kvoptions sty url sty rerunfilecheck sty bookmark sty amsthm sty luatexja otf sty luatexja ajmacros sty luatexja fontspec sty l3keys2e sty expl3 sty fontspec sty xparse sty fontspec patches sty fixltx2e sty fontspec luatex sty fontenc sty xunicode sty 2014 01 12 2001 11 08 2005 04 14 2014 04 23 2014 03 28 2014 03 04 2014 03 04 2014 01 19 2007 08 22 2001 05 26 2009 03 30 2012 11 06 2012 05 28 2012 05 28 2012 05 28 2007 09 27 2011 02 16 2012 04 25 2011 04 07 2011 11 25 2012 04 08 2011 01 30 2011 01 30 2010 09 02 2012 05 28 2011 01 3
34. e range returns 0 if characters which belong to the character range range are JAchar 1 if are ALchar Although there is no character range 1 specifying 1 to range does not cause an error returns 1 For an integer digit between 0 and 9 ltjgetparameter kansujichar digit returns the character code of the result of kansuji digit The following parameter names cannot be specified in Nltjgetparameter jatextfont jascriptfont jascriptscriptfont jacharrange 25 WR Bw ON o Row e ltjgetparameter chartorange chr_code returns the range number which chr_code be longs to although there is no parameter named chartorange If chr_code is between 0 and 127 this chr_code does not belong to any character range In this case ltj getparameter chartorange chr_code returns 1 Hence one can know whether chr_code is JAchar or not by the following ltjgetparameter jacharrange ltjgetparameter chartorange chr_code 0 if JAchar 1 if ALchar 7 3 Mtjsetkanjiskip ltjsetxkanjiskip ltjsetparameter and ltjglobalsetparameter are slow since their argument is a key value list This can be a problem in 1tjsclasses because kanjiskip and xkanjiskip are set in every font resizing commands setfontsize To overcome this problem this version of LuaTEX ja provides two more internal commands namely N1tjsetkanjiskipi skip and ltjsetxkanjiskip skip Note that 1tj setpar
35. e In addition to OpenType font features in the original fontspec the fol lowing font features specifications are allowed for the commands of Japanese version CID name JFM name JFM var name These 3 keys correspond to cid jfm and jfmvar keys for jfont respectively CID is effective only when with NoEmbed described below See Subsections 6 1 and 6 2 for details NoEmbed By specifying this key one can use name only Japanese font which will not be embedded in the output PDF file See Subsection 6 2 AltFont As lt jdeclarealtfont Subsection 8 3 and DeclareAlternateKanjiFont Subsection 9 1 with this key one can typeset some Japanese characters by a different font and or using different features The AltFont feature takes a comma separated list of comma separated lists as the fol lowing 29 v6 0 xn oau Roo MW jfontspec AltFont Range 4E00 67FF Color 007F00 Range 6800 9EFF Color 0000FF Range 3040 306F Font KozGoPr6N Regular KozMinPr6N Regular AFERA ESICREeCNKBRICSWORRS SIC CTL DNSEDNSOFRORMOI MARC OMMICKEMRL DABStICDEOTRAHOSEST EGRE REURU ces HARIRI ERIC RE NEM AICEW SRA SMC CAIB DNEEDNEDFROKYD lc HEHE EOD ACA RRE DAHeHICDKOCAHOSES5T ARER sen Figure 5 An example of AltFont AltFont Range range features Range range Font font name features Y Range range Font font name Y Each sublist should have the Range key subli
36. e permitted on both sides except for brackets dashes etc Hence the patch 11tjp listings introduces a new flag lst ifkanji which indicates whether the previous character is a Japanese character or not For illustration we introduce following classes of characters Letter Other Kanji Open Close lst ifletter T F T F T lst ifkanji F F T T F Meaning char in an identifier other alphabet most of Japanese char opening brackets closing brackets Note that digits in the listings package can be Letter or Other according to circumstances For example let us consider the case an Open comes after a Letter Since an Open represents Japanese open brackets it is preferred to be permitted to insert line break after the Letter Therefore the collected character string is output in this case The following table summarizes 5 x 5 25 cases 37 Next Letter Other Kanji Open Close Letter collects Outputs collects Other outputs collects outputs collects Prev Kanji outputs collects Open collects Close outputs collects In the above table outputs means to output the collected character string i e line breaking is permitted there collects means to append the next character to the collected character string i e line breaking is prohibited there Charatcers above U 0080 except Variation Selectors are classified into above 5 classes by the following rules ALchars above U 0080 are classi
37. eavevmode fboxsep 0pt ltjsetparameter yjabaselineshift 0pt yalbaselineshift 0pt vrule width 105pt height 0 4pt depth Opt hskip 95pt dw HV fbox lt jsetparameter yalbaselineshift 10pt H UD xyz XYZ DUO fbox lt jsetparameter yalbaselineshift 10pt Hl 2xyz NN XVZ XVZ vrule width 105pt height 0 4pt depth Opt hskip 95pt dw fbox lt jsetparameter yjabaselineshift 10pt H UD xyz fbox lt jsetparameter yjabaselineshift 10pt dU 2xyz 14 Table 4 Nkcatcode in upIEX kcatcode meaning control word widow penalty linebreak 15 non cjk treated as usual TEX 16 kanji Y Y ignored 17 kana Y Y ignored 18 other N N ignored 19 hangul Y Y space Part II Reference 5 catcode in LuaTpx ja 5 1 Preliminaries kcatcode in pIpX and upIgX In pIEX and upIEX the value of kcat code determines whether a Japanese character can be used in a control word For the detail see Table 4 kcatcode can be set by a row of JIS X 0208 in pIgX and generally by a Unicode block in upIgX So characters which can be used in a control word slightly differ between pIEX and upIpX 5 2 Case of Lua T X ja The role of kcatcode in pIpX and upIEX caan be divided into the following four kinds and Lua TEX ja can control these four kinds separately Distinction between JAchar or ALchar is controlled by using the character range see Subsection 4 1 Whether the character can be used in a con
38. elongs A function used in this callback should be in the following form function lt number gt char class lt table gt jfont info number chr code if char class 0 then return char class else 2 3 4 5 return lt number gt new_char_class or 0 6 end 7 end The argument char_class is the result of LuaTpxX ja s default routine or previous function calls in this callback hence this argument may not be 0 Moreover the returned new_char_class should be as same as char class when char class is not 0 otherwise you will overwrite the LuaTpX ja s default routine luatexja set width callback This callback is called when LuaTpX ja is trying to encapsule a JAchar glyph node to adjust its dimension and position function lt table gt shift info lt table gt jfont info number char class 2 return lt table gt new shift info 3 end The argument shift info and the returned new shift info have down and left fields which are the amount of shifting down left the character in a scaled point A good example is test valign lua After loading this file the vertical position of glyphs is auto matically adjusted the ratio height depth of glyphs is adjusted to be that of letters in the character class 0 For example suppose that The setting of the JFM height 88x depth 12x the standard values of Japanese Open Type fonts The value of the real font height 28y depth 5y the standard va
39. f this manual 10 4 luatexja ruby sty This addon package provides functionality of ruby furigana annotations using callbacks of LuaTpX ja There is no detailed manual of luatexja ruby sty in English Japanese manual is another PDF file luatexja ruby pdf Group ruby By default ruby characters the second argument of ruby are attached to base characters the first argument as one object This type of ruby is called group ruby BEIT W RR ruby HHH KS TAHRAN sea oua 2 RRO ruby EH E 5 CRI HETERO p laa s REO Nruby DEAD THIEWS ERN be 4 BR PGR Uy E AHOT OR HIROD ey 55 RCD BLES PUER As the above example ruby hangover is allowed on the Hiragana before after its base characters Mono ruby To attach ruby characters to each base characters mono ruby one should use ruby multiple times REO ruby HAS ruby BH CARIES spass lob HERA Jukugo ruby Vertical bar denotes a boundary of groups 1 ruby i HAA 2 ITAR es 2 ruby IBAN hb Ba Soy hp s ruby 38 RID 5 ED 31 If there are multiple groups in one ruby call A linebreak between two groups is allowed 1 vbox hsize 6 zw noindent T s sb 2 hbox to 2 5NzwO Nruby Om Ug US LED P I6 2 DE fe us is 3 hbox to 2 5Nzw ONruby Om A EL BH RI 2 DE fe n m Bu 4 hbox to 3VzuO ruby Oz A URIBE 5 1D fe Wo m i3 EDD If the width of ruby characters are longer than that of base characters ruby automatically selects the appropriate form among t
40. fied as Letter JAchars are classified in the order as follows 1 Characters whose prebreakpenalty is greater than or equal to 0 are classified as Open 2 Characters whose postbreakpenalty is greater than or equal to 0 are classified as Close 3 Characters that don t satisfy the above two conditions are classified as Kanji The width of halfwidth kana U FF61 U FF9F is same as the width of ALchar the width of the other JAchars is double the width of ALchar This classification process is executed every time a character appears in the 1stlisting environment or other environments commands 14 Cache Management of Lua T X ja LuaTpX ja creates some cache files to reduce the loading time in a similar way to the luaotfload package e Cache files are usually stored in and loaded from TEXMFVAR 1uatexja e n addition to caches of the text form the extension is lua caches of the binary precompiled form are supported We cannot share same binary cache for Lua TEX and LuaJITTEX Hence we distinguish them by their extension 1uc for LuaTEX and 1ub for LuaJITTEX In loading a cache the binary cache precedes the text form When LuaTpx ja updates a cache hoge lua its binary version is also updated 14 1 Use of Cache LuaTpX ja uses the following cache ltj cid auto adobe japani lua The font table of a CID keyed non embedded Japanese font This is loaded in every run It is created from two CMap
41. font family with re spect to current Japanese font family which was set by DeclareRelationFont or SetRelationFont Like fontfamily selectfont is required to take an effect adjustbaseline In pl4IEX 2 adjustbaseline sets tbaselineshift to match the vertical center of M and that of 25 in vertical typesetting Ay dy hz dy 2 where h and d denote the height of a and the depth respectively tbaselineshift dy dy Current LuaTEX ja does not support vertical typesetting so this adjustbaseline has almost no effect fontfamily family As in BIEX 2 this command changes current font family alphabetic Japanese or both to family Which family will be changed is determined as follows Let current encoding scheme for Japanese fonts be ja enc Current Japanese font family will be changed to family if one of the following two conditions is met 28 The family family under the encoding ja enc has been already defined by NDeclareKani jFamily A font definition named ja enc family d the file name is all lowercase exists Let current encoding scheme for alphabetic fonts be al enc For alphabetic font family the criterion as above is used There is a case which none of the above applies that is the font family named family doesn t seem to be defined neither under the encoding ja enc nor under al enc In this case the default family for fo
42. g high quality Japanese documents when using LuaTpx 1 1 Backgrounds Traditionally ASCII pIEX an extension of TEX and its derivatives are used to typeset Japanese documents in TEX pIEX is an engine extension of TEX so it can produce high quality Japanese documents without using very complicated macros But this point is a mixed blessing pIEX is left behind from other extensions of TEX especially I X and pdf T X and from changes about Japanese processing in computers e g the UTF 8 encoding Recently extensions of pIEX namely upIEX Unicode implementation of pIEX and epIEX merging of pIEX and e T X extension have developed to fill those gaps to some extent but gaps still exist However the appearance of LuaTpX changed the whole situation With using Lua callbacks users can customize the internal processing of LuaT X So there is no need to modify sources of engines to support Japanese typesetting to do this we only have to write Lua scripts for appropriate callbacks 1 2 Major Changes from pIEX The Lua TEX ja package is under much influence of pIEX engine The initial target of development was to implement features of pIEX However LuaTEX ja is not a just porting of plgX unnatural specifications be haviors of pIgX were not adopted The followings are major changes from plEX e A Japanese font is a tuple of a real font a Japanese font metric JFM for short In pIEX a line break after Japanese
43. glue E 20 0pt 3 the wdO Now we look why the above source outputs 20 pt not 15 pt 1 The ideographic full stop is converted to its vertical form U FE12 by vert feature 2 The character class of is zero hence its width is fullwidth 3 The character class of 15 hence its width is fullwidth 4 Ninhibitglue makes that no glue will be inserted between o and ji 5 Hence the width of hbox equals to 20 pt This example shows that the character class of a character is determined after applying font features by Luaotf Load However a starred specificaion like changes the rule Consider the following input 1 jfont a file KozMinPr6N Regular otf jfm test vert TEE 2 Na E inhibitglue j R R Here the character class of the ideographic comma U 3001 is determined as following 1 As the case of the ideographic comma is converted to its vertical form U FE11 2 The character class of is zero 3 However Lua TEX ja remembers that this is obtained from gt by font features The character class of is non zero value namely 2000 4 Hence the ideographic comma in above belongs the character class 2000 MImaginary characters As described before you can specify several imaginary characters in chars field The most of these characters are regarded as the characters of class 0 in pIEX As a result Lua TEX ja can contro
44. glyph node 1tj yablshift attribute The amount of shifting the baseline of alphabetic fonts in scaled point 2 pt 1tj ykblshift attribute The amount of shifting the baseline of Japanese fonts in scaled point 2716 pt 1tj autospe attribute Whether the auto insertion of kanjiskip is allowed at the node 1tj autoxspce attribute Whether the auto insertion of xkanjiskip is allowed at the node 1tj icflag attribute An attribute for distinguishing kinds of a node One of the following value is assigned to this attribute italic 1 Kerns from italic correction or from kerning information of a Japanese font These kerns are ignored in the insertion process of JAglue unlike explicit Nkern packed 2 32 Rw Ne 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 kinsoku 3 Penalties inserted for the word wrapping process kinsoku shori of Japanese charac ters from fm 2 from jfm 2 4 8 Glues kerns from JFM kanji skip 9 kanji skip jfm 10 Glues from kanjiskip xkanji_skip 11 xkanji_skip fm 12 Glues from xkanjiskip processed 13 Nodes which is already processed by ic_processed 14 Glues from an italic correction but already processed in the insertion process of JAglues boxbdd 15 Glues kerns that inserted just the beginning or the ending of an hbox or a paragraph 1tj kcati attribute Where i is a natural number which is less than 7 These 7 a
45. gn field is middle The black rectangle is a frame of the node Its width height and depth are specified by JFM e Since the align field is middle the real glyph is cen tered horizontally the green rectangle depth Furthermore the glyph is shifted according to values of fields left and down The ultimate position of the real glyph is indicated by the red rectangle Figure 3 The position of the real glyph width length height length depth length italic length required Specifythe width of characters in character class i the height the depth and the amount of italic correction All characters in character class i are regarded that its width height and depth are as values of these fields But there is one exception width field can be prop This means that width of a character becomes that of its real glyph left length down length align align These fields are for adjusting the position of the real glyph Legal values of align field are left middle and right If one of these 3 fields are omitted left and down are treated as 0 and align field is treated as left The effects of these 3 fields are indicated in Figure 3 In most cases left and down fields are 0 while it is not uncommon that the align field is middle or right For example setting the align field to right is practically needed when the current character class is the class for opening delimiters
46. haracters used in Japanese The block list is indicated in Table 2 Range 7 Characters used in CJK languages but not included in Adobe Japan1 6 The block list is indicated in Table 3 12 Table 1 Unicode blocks in predefined character range 3 U 2000 U 206F General Punctuation U 2070 U 209F Superscripts and Subscripts U 20A0 U 20CF Currency Symbols U 20D0 U 20FF Comb Diacritical Marks for Symbols U 2100 U 214F Letterlike Symbols U 2150 U 218F Number Forms U 2190 U 21FF Arrows U 2200 U 22FF Mathematical Operators Control Pictures Block Elements Miscellaneous Symbols Supplemental Arrows B Miscellaneous Symbols and Arrows U 2300 U 23FF U 2500 U 257F U 25A0 U 25FF U 2700 U 27BF U 2980 U 29FF U 2400 U 243F U 2580 U 259F U 2600 U 26FF U 2900 U 297F U 2B00 U 2BFF Miscellaneous Technical Box Drawing Geometric Shapes Dingbats Misc Mathematical Symbols B Table 2 Unicode blocks in predefined character range 6 U 2460 U 24FF Enclosed Alphanumerics U 2E80 U 2EFF CJK Radicals Supplement U 3000 U 303F CJK Symbols and Punctuation U 3040 U 309F Hiragana U 30A0 U 30FF Katakana U 3190 U 319F Kanbun U 31F0 U 31FF Katakana Phonetic Extensions U 3200 U 32FF Enclosed CJK Letters and Months U 3300 U 33FF CJK Compatibility U 3400 U 4DBF CJK Unified Ideographs Extension A U 4E00 U 9FFF CJK Unified Ideographs U F900 U FAFF CJK Compatibility Ideographs U FE10 U FE1F U FE50 U FE6F U E0100 U E01EF
47. he line head form the line middle form and the line end form 1 vbox hsize 8 zw noindent 0000000000000 quee Xo 2 null kern3 zw c5 ZA NrubyUKH 2 V fc ED S Stb 3 MkerniWzw c0 ruby RH UJ Tc EDA ea TK 4 null kern5 zw amp ruby A 2 0 72 EDS ume CMS pa 5 x t Part III Implementations 11 Storing Parameters 11 1 Used Dimensions Attributes and Whatsit Nodes Here the following is the list of dimensions and attributes which are used in Lua TEX ja jQ dimension jQ is equal to 1 Q 0 25 mm where Q also called KK is a unit used in Japanese phototypesetting So one should not change the value of this dimension oo ES jH dimension There is also a unit called Ki which equals to 0 25 mm and used in Japanese photo typesetting This jH is the same Ndimen register as jQ 1tj zw dimension A temporal register for the full width of current Japanese font The command zw sets this register to the correct value and return this register itself 1tj zh dimension A temporal register for the full height usually the sum of height of imaginary body and its depth of current Japanese font The command zh sets this register to the correct value and return this register itself jfam attribute Current number of Japanese font family for math formulas 1tj curjfnt attribute The font index of current Japanese font 1tj charclass attribute The character class of Japanese
48. ibitglue 7 D Ub inhibitglue par noindent 1 5 1 par inhibitglue noindent 2 d 2 par noindent inhibitglue 3 3 par hrule noindent offlinhibitglue ice do office With the help of this example we remark the specification of inhibitglue e The call of Ninhibitglue in the internal vertical mode is simply ignored The call of Ninhibitglue in the restricted horizontal mode is only effective on the spot does not get over boundary of paragraphs Moreover Ninhibitglue cancels ligatures and kernings as shown in the last line of above example The call of Ninhibitglue in math mode is just ignored 8 3 ltjdeclarealtfont Using N1tjdeclarealtfont one can compose more than one Japanese fonts This lt jdeclarealtfont uses in the following form Mtjdeclarealtfont base font cs alt font cs range where base font cs and alt_font_cs are defined by jfont Its meaning is If the current Japanese font is base_font_cs characters which belong to range is typeset by another Japanese font alt font cs instead of base font cs range is a comma separated list of character codes but also accepts negative integers n n gt 1 means that all characters of character classes n with respect to JFM used by base font cs Note that characters which do not exist in alt font cs are ignored For example if Nhoge uses jfm ujis lua the standard JFM of LuaTEX ja then MtjdeclarealtfontMhogeNpiyo 3000 3OFF 1 1 d
49. ick correctly assignments to N1t stack and 1t j group level have to be local always regardless the value of globaldefs To solve this problem we use another trick the assignment directlua tex globaldefs 0 is always local 11 3 Lua Functions of the Stack System In this subsection we will see how a user use Lua TpX ja s stack system to store some data which obeys the grouping of TEX The following function can be used to store data into a stack luatexja stack set stack table index any data Any values which except nil and NaN are usable as index However a user should use only negative integers or strings as index since natural numbers are used by Lua TpX ja itself Also whether data is stored locally or globally is determined by luatexja isglobal stored globally if and only if luatexja isglobal global Stored data can be obtained as the return value of luatexja stack get_stack_table index lt any gt default lt number gt level where level is the stack level which is usually the value of 1t j stack and default is the default value which will be returned if no values are stored in the stack table whose level is level 11 4 Extending Parameters Keys for lt jsetparameter and M1tjgetparameter can be extended as in luatexja adjust 6 Dev luatex tex currentgrouplevel a post at 2008 8 19 by Jonathan Sauer 34 330 protected def M t j setpar global 381 relax ifnum globaldefs gt 0 directlua lu
50. ify how glues kerns between two JAchars whose JFM or size are different The allowed arguments are the followings average both large small pleft pright paverage The default value is paverage jacharrange ranges kansujichar t digit chr code Nkansujichar 7 2 ltjgetparameter Xltjgetparameter is a conteol sequence for acquiring parameters It always takes a parameter name as first argument ltjgetparameter differentjfm 1tjgetparameter autospacing ltjgetparameter kanjiskip paverage 1 0 0pt plus 0 4pt minus 0 4pt 10000 ltjgetparameter prebreakpenalty Y The return value of N1tjgetparameter is always a string This is outputted by tex write so any character other than space U 0020 has the category code 12 other while the space has 10 space Tf first argument is one of the following no additional argument is needed jcharwidowpenalty yjabaselineshift yalbaselineshift autospacing autoxspacing kanjiskip xkanjiskip differentjfm Note that ltjgetparameter autospacing and ltjgetparameter autoxspacing returns 1 or 0 not true nor false If first argument is one of the following an additional argument a character code for example is needed kcatcode prebreakpenalty postbreakpenalty jaxspmode alxspmode ltjgetparameter jaxspmode and ltjgetparameter alxspmode returns 0 1 2 or 3 instead of preonly etc 1t j getparameter jacharrang
51. ine the parameter kanjiskip is stored by a skip and consider the following source Mtjsetparameterfkanjiskip 0Opt A HSH setbox0 hbox Mtjsetparametertkanjiskip 5pt HF V7 box0 U KU ENpar SISPAE WF UE WO KOK As described in Subsection 7 1 the only effective value of kanjiskip in an hbox is the latest value so the value of kanjiskip which applied in the entire hbox should be 5 pt However by the implementation method of LuaTEX this 5 pt cannot be known from any callbacks In the tex packaging w which is a file in the source of LuaTEX there are the following codes void package int c scaled h height of box halfword p first node in a box scaled d max depth int grp grp cur_group d box_max_depth unsave save_ptr 4 33 1236 1237 1238 1239 1240 if cur_list mode field hmode cur_box filtered_hpack cur_list head_field cur_list tail_field saved_value 1 saved level 1 grp saved level 2 subtype cur box HLIST SUBTYPE HBOX Notice that unsave is executed before filtered hpack where hpack filter callback is executed here So 5 pt in the above source is orphaned at unsave and hence it can t be accessed from hpack filter callback Mimplementation The code of stack system is based on that in a post of Dev luatex mailing list These are two TEX count registers for maintaining information 1tj stack for the stack level and 1t j gro
52. it 3 3 Presets To use standard Japanese font settings easily one can load luatexja preset package with several options This package provides functions in a part of japanese otf package and a part of PXchfon package by Takayuki Yato and loads luatexja fontspec hence fontspec internally If you need to pass some options to fontspec load fontspec manually before luatexja preset usepackage no math fontspec usepackage luatexja preset W General options nodeluxe Use one weighted mincho and gothic font families This means that mcfamily bfseries gtfamily bfseries and gtfamily mdseries use the same font This option is enabled by default deluxe Use mincho with two weights medium and bold gothic with three weights medium bold and heavy and rounded gothic The heavy weight of gothic can be used by changing the family V gtebfamily or textgteb This is because fontspec package can handle only medium mdseries and bold Nbfseries expert Use horizontal kana alternates and define a command rubyfamily to use kana characters designed for ruby bold Substitute bold series of gothic for bold series of mincho 90jis Use 90JIS glyph variants if possible jis2004 Use JIS2004 glyph variants if possible jis Use the JFM jfm jis lua instead of jfm ujis lua which is the default JFM of LuaTpx ja Note that 90jis and jis2004 only affect with mincho gothic and possibly rounded gothic defined by this package
53. ities for LuaTeX luatexbase loader sty 2013 05 11 v0 6 Lua module loader for LuaTeX luatexbase regs sty 2011 05 24 v0 4 Registers allocation for LuaTeX luatexbase attr sty 2013 05 11 v0 6 Attributes allocation for LuaTeX luatexbase cctb sty 2013 05 11 v0 6 Catcodetable allocation for LuaTeX luatexbase mcb sty 2013 05 11 v0 6 Callback management for LuaTeX ltxcmds sty 2011 11 09 v1 22 LaTeX kernel commands for general use HO pdftexcmds sty 2011 11 29 v0 20 Utility functions of pdfTeX for LuaTeX HO xkeyval sty 2014 05 09 v2 6d package option processing HA ltj base sty 2013 05 14 ltj latex sty 2013 05 14 LaTeX support of LuaTeX ja 11tjfont sty 2014 01 23 Patch to NFSS2 for LuaTeX ja everysel sty 2011 10 28 v1 2 EverySelectfont Package MS lltjdefs sty 2013 06 12 Default font settings of LuaTeX ja lltjcore sty 2013 05 14 Patch to LaTeX2e Kernel for LuaTeX ja luatexja compat sty 2013 12 22 Compatibility with pTeX amsmath sty 2013 01 14 v2 14 AMS math features amstext sty 2000 06 29 v2 01 amsgen sty 1999 11 30 v2 0 amsbsy sty 1999 11 29 v1 2d amsopn sty 1999 12 14 v2 01 operator names array sty 2008 09 09 v2 4c Tabular extension package FMi tikz sty 2013 12 13 v3 0 0 rcs revision 1 142 pgf sty 2013 12 18 v3 0 0 rcs revision 1 14 pgfrcs sty 2013 12 20 v3 0 0 rcs revision 1 28 everyshi sty 2001 05 15 v3 00 EveryShipout Package MS pgfcore sty 2010 04 11 v3 0 0 rcs revision 1 7 graphicx sty 2014 04 25 v1 0g Enhanced LaTeX Graphi
54. jiskip 1 jfont E file KozMinPr6N Regular otf extend 1 5 jfm ujis kern 2 E DUDAR 3 4 NjfontNS file KozMinPr6N Regular otf slant 1 jfm ujis kern s AS do 2N ABC da DARKS DBC 7 ABC 6 2 Prefix psft Besides file and name prefixes which are introduced in the luaotf load package Lua TEX ja adds psft prefix in jfont and font to specify a name only Japanese font which will not be embedded to PDF Typical use of this prefix is to specify standard non embedded Japanese fonts namely Ryumin Light and GothicBBB Medium OpenType font features such as jp90 have no meaning in name only fonts using pstt prefix because we can t expect what fonts are actually used by the PDF reader Note that extend and slant settings see above are supported with psft prefix because they are only simple linear transformations Mcid key The default font defined by using psft prefix is for Japanese typesetting it is Adobe Japan1 6 CID keyed font One can specify cid key to use other CID keyed non embedded fonts for Chinese or Korean typesetting 1 jfont test J psft Ryumin Light cid Adobe Japan1 6 jfm jis Japanese 2 jfont testD psft Ryumin Light jfm jis default value is Adobe Japani 6 3 jfont testC psft AdobeMingStd Light cid Adobe CNS1 6 jfm jis Traditional Chinese 4 jfont testG psft SimSun cid Adobe GB1 5 jfm jis 4 Simplified Chinese s jfont testk psft Bata
55. l typesetting finer than pIEX The following is the list of imaginary characters boxbdd Thebeginning ending of a hbox and the beginning of a noindented i e began by noindent paragraph parbdd The beginning of an indented paragraph jcharbdd A boundary between JAchar and anything else such as ALchar kern glue 1 The left right boundary of an inline math formula ll Porting JFM from pIgX See Japanese version of this manual 6 4 Math Font Family TEX handles fonts in math formulas by 16 font families and each family has three fonts textfont scriptfont and Nscriptscriptfont LuaTpX ja s handling of Japanese fonts in math formulas is similar Table 7 shows counterparts to TEX s primitives for math font families There is no relation between the value of fam and that of jfam with appropriate settings you can set both fam and Nj fam to the same value Omega Aleph Lua TpX and e u pI X can handles 256 families but an external package is needed to support this in plain TEX and BIEX 21 Table 7 Commands for Japanese math fonts Japanese fonts alphabetic fonts jfam 0 256 fam jatextfont jfam jfont_cs textfont fam font_cs jascriptfont jfam jfont_cs scriptfont fam font_cs jascriptscriptfont jfam jfont_cs Nscriptscriptfont fam font cs 6 5 Callbacks LuaTpX ja also has several callbacks These callbacks can be accessed via luatexbase add_to_call
56. line of one of the pair is needed In pIpX this is achieved by setting ybaselineshift to a non zero length the baseline of ALchar is shifted below However for documents whose main language is not Japanese it is good to shift the baseline of Japanese fonts but not that of alphabetic fonts Because of this Lua TEX ja can independently set the shifting amount of the baseline of alphabetic fonts yalbaselineshift parameter and that of Japanese fonts yjabaselineshift parameter vrule width 150pt height 0 4pt depth Opt hskip 120pt 1tjsetparameter yjabaselineshift Opt yalbaselineshift 0pt abcH 2 1tjsetparameter yjabaselineshift 5pt yalbaselineshift 2pt abcH 2 Here the horizontal line in above is the baseline of a line There is an interesting side effect characters in different size can be vertically aligned center in a line by setting two parameters appropriately The following is an example beware the value is not well tuned xyz AF scriptsize ltjsetparameter yjabaselineshift 1pt yalbaselineshift 1pt XYZO 5 DV abc xyz EF XYZ 051 abc 27 Note that setting a positive value to yalbaselineshift does not increase the depth of ALchar as shown be low This is because yalbaselineshift is implemented by setting xof fset field of a glyph node and this does not increase the depth of the glyph This problem does not apply for yjabaselineshift since yjabaselineshift uses a different implementation method l
57. lues of Japanese True Type fonts Then the position of glyphs is shifted up by 88x 26 ss 9 28y y 1 04y Sm SSA 7 Parameters 7 1 ltjsetparameter As described before 1lt jsetparameter and ltjgetparameter are commands for accessing most pa rameters of LuaTpX ja One of the main reason that LuaTEX ja didn t adopted the syntax similar to that of pIEX e g prebreakpenalty 10000 is the position of hpack_filter callback in the source of LuaTpx see Section 11 Mtjsetparameter and ltjglobalsetparameter are commands for assigning parameters These take one argument which is a key value list The list of allowed keys are described in the next sub section The difference between N1t jsetparameter and ltjglobalsetparameter is only the scope of assignment Nt jsetparameter does a local assignment and ltjglobalsetparameter does a global one They also obey the value of globaldefs like other assignment The following is the list of parameters which can be specified by the NX1t jsetparameter command Ncs indicates the counterpart in pIEX and symbols beside each parameter has the following meaning 23 e Sx values at the end of a paragraph or a hbox are adopted in the whole paragraph or the whole hbox e t assignments are always global jcharwidowpenalty penalty jcharwidowpenalty Penalty value for suppressing orphans This penalty is inserted just after the last JAchar which is not regarded as a
58. mount of kanjiskip As noted in Subsection 4 2 if the parameter kanjiskip is maxdimen the value specified in this field is actually used if this field is not specified in JFM it is regarded as 0 pt Note that stretch and shrink fields are in design size unit too xkanjiskip natural stretch shrink optional Like the kanjiskip field this field specifies the ideal amount of xkanjiskip Mi Character classes Besides from above fields a JFM file have several sub tables those indices are natural numbers The table indexed by i stores information of character class i At least the character class 0 is always present so each JFM file must have a sub table whose index is 0 Each sub table its numerical index is denoted by i has the following fields chars i character required except character class 0 This field is a list of characters which are in this character type i This field is optional if i 0 since all JAchar which do not belong any character classes other than 0 are in the character class 0 hence the character class O contains most of JAchars In the list character s can be specified in the following form a Unicode code point e the character itself as a Lua string like d5 e a string like d5 the character followed by an asterisk several imaginary characters We will describe these later 19 Consider a node containing Japanese character whose value of the ali
59. ng cid Adobe Korea1 2 jfm jis 4 Korean Note that the code above specifies j fm jis lua which is for Japanese fonts as JFM for Chinese and Korean fonts At present LuaT X ja supports only 4 values written in the sample code above Specifying other values e g jfont test psft Ryumin Light cid Adobe Japan2 jfm jis produces the following error 18 1 Package luatexja Error bad cid key Adobe Japan2 2 3See the luatexja package documentation for explanation 4Type H return for immediate help s lt to be read again gt 6 par 71 78 8 9 h 10 I couldn t find any non embedded font information for the CID 1 Adobe Japan2 For now I ll use Adobe Japani 6 n Please contact the LuaTeX ja project team 137 6 3 Structure of a JFM File A JFM file is a Lua script which has only one function call luatexja jfont define jfm Real data are stored in the table which indicated above by So the rest of this subsection are devoted to describe the structure of this table Note that all lengths in a JFM file are floating point numbers in design size unit dir direction required The direction of JEM At the present only yoko is supported zw length required The amount of the length of the full width zh length required The amount of the full height height depth kanjiskip natural stretch shrink optional This field specifies the ideal a
60. nt substitution is used for alphabetic and Japanese fonts Note that current encoding will not be set to family unlike the original implementation in BIEX MDeclareAlternateKanjiFonti base encoding X base family M base series base shape alt encoding M alt family TX alt series X alt shape MX range As Mtjdeclarealtfont Subsection 8 3 characters in range of the Japanese font we say the base font which specified by first 4 arguments are typeset by the Japanese font which specified by fifth to eighth arguments we say the alternate font An example is shown in Figure 4 e In lt jdeclarealtfont the base font and the alternate font must be already defined But this DeclareAlternateKanjiFont is not so In other words DeclareAlternateKanjiFont is effective only after current Japanese font is changed or only after selectfont is executed As closing this subsection we shall introduce an example of SetRelationFont and userelfont makeatletter SetRelationFont JY3 k family m n 0T1 pag m n k family current Japanese font family userelfont selectfont LD abc bl 3 abc 10 Addons LuaT X ja has several addon packages These addons are written as I4TRX packages but luatexja otf and luatexja adjust can be loaded in plain LuaT X by input 10 1 luatexja fontspec sty As described in Subsection 3 2 this optional package provides the counterparts for several commands de fined in the fontspec packag
61. o enable this load luatezja otf and execute the following directlua luatexja otf enable_ivs After executing the command above you can use IVS like the following 30 no adjustment AED EHH lk TAREHE E MK EF 152 without priority AED NENA ORRE is KRFA Note the value of kanjiskip is Opt s in this figure for making the difference obvious Figure 6 Line adjustment 1 Large 2 jfontspec KozMinPr6N Regular T ERSTE RREREME AAS ihc RKA RME 4 E c 1 WS gt SRESEASER ER wae PENE DEE ES VEO DE C Ac ld SR YEDXEDEOEHEDEDEGRE 3ER OEOR ER OES ER ORO SERS EO Ed NENEN BJA 6 Xoe 106 12 107 108 109 3ESIOEORE3 OEO S E 0E0 E3JOEOR ES OEO X88 er KE IBI Le amp hu 7 JP OA PEF 1 0B 1 0C 4 1 OD PE 1 0E sh Specifying glyph variants by IVS precedes glyph replacement by font features For example only Ej in 5 4 is changed by font features jp78 or jp90 which does not followed by any variation selector texttt jp78 NTEST CJKShape JIS1978 texttt jp90 NTEST CJKShape JIS1990 1 def TEST 1 2 jfontspec 1 KozMinPr6N Regular JEXEZE UL ETH BAK Sp gt BRET SEME EN je78 Sii SAK ipu JEETS L TEST jp90 Bix AA E 10 3 luatexja adjust sty see Japanese version o
62. oes If the current Japanese font is Nhoge U 3000 U 30FF and characters in class 1 ideographic opening brackets are typeset by piyo 9 Commands for TFX 2 9 1 Patch for NFSS2 Japanese patch for NFSS2 in LuaTpX ja is based on plfonts dtx which plays the same role in plATEX 2 We will describe commands which are not described in Subsection 3 1 additonal dimensions Like plAIEX 2 LuaTpEX ja defines the following dimensions for information of current Japanese font cht height Ncdp depth cHT sum of former two cwd width Ncvs lineskip chs equals to Ncwd and its normalsize version Cht height Cdp depth Cwd width Cvs equals to baselineskip Chs equals to cwd 27 o u Q a B ow N e DeclareKanjiFamily JY3 edm DeclareFontShape JY3 edm m n lt gt s KozMinPr6N Regular jfm ujis DeclareFontShape JY3 edm m green lt gt s KozMinPr6N Regular jfm ujis color 007F00 DeclareFontShape JY3 edm m blue lt gt s KozMinPr6N Regular jfm ujis color 0000FF DeclareAlternateKanjiFont JY3 edm m n JY3 edm m green 4E00 67FF 2 2 DeclareAlternateKanjiFont JY3 edm m n JY3 edm m blue 6800 9FFF kanjifamily edm selectfont ESERE EEZ NEARE RRS SIC CAML se HARIRI IE 4 ICES Nie AIC 0 SRR IU CTH Lo Figure 4 An example of DeclareAlternateKanjiFont Note that cwd and cHT may differ from zw and zh respectively On the one hand the f
63. ores default kinsoku parameters cd src lualatex ltjclasses ins lualatex ltjsclasses ins lualatex ltjltxdoc ins luatex 1tj kinsoku_make tex Note that dtx ins and 1tj kinsoku make tex are not needed in regular use Copy all the contents of src into one of your TEXMF tree TEXMF tex luatex luatexja is an example location If you cloned entire Git repository making a symbolic link of src instead copying is also good If mktexl1sr is needed to update the file name database make it so 5 2 2 2 3 Cautions The encoding of your source file must be UTF 8 No other encodings such as EUC JP or Shift JIS are not supported LuaTpX ja is very slower than pIEX Generally speaking LuaJITTEX processes LuaTpX ja about 30 faster than LuaTpx but not always Note for MiKTgX users Lua TEX ja requires that several CMap files must be found from LuaTpX Strictly speaking those CMaps are needed only in the first run of LuaTpX ja after installing or updat ing But it seems that MiKTEX does not satisfy this condition so you will encounter an error like the following LuaTeX error iles x86 MiKTeX 2 9 tex luatex luatexja ltj rmlgbm lua bad argument 1 to open string expected got nil If so please execute a batch file which is written on the Project Wiki English This batch file creates a temporaly directory copy CMaps in it run LuaTpEX ja in this directory and finally delete the temporaly
64. ormer di mensions are determined from the character dS but on the other hand zw and zh are specified by JFM DeclareYokoKanjiEncoding encoding text settings math settings In NFSS2 under LuaTpX ja distinction between alphabetic font families and Japanese font families are only made by their encodings For example encodings OT1 and T1 are for alphabetic font families and a Japanese font family cannot have these encodings This command defines a new encoding scheme for Japanese font family in horizontal direction DeclareKanjiEncodingDefaults text settings math settings DeclareKanjiSubstitution encoding family series shape DeclareErrorKanjiFont encoding family series shape size The above 3 commands are just the counterparts for DeclareFontEncodingDefaults and others reDeclareMathAlphabet unified cmd al cmd ja cmd DeclareRelationFont ja encoding ja family ja series ja shape al encoding al family al series al shape This command sets the accompanied alphabetic font family given by the latter 4 arguments with respect to a Japanese font family given by the former 4 arguments SetRelationFont This command is almost same as DeclareRelationFont except that this command does a local assignment where DeclareRelationFont does a global assignment userelfont Change current alphabetic font encoding family to the accompanied alphabetic
65. owing two types Note that the classification can be customized by a user see Subsection 4 1 JAchar standing for characters which used in Japanese typesetting such as Hiragana Katakana Kanji and other Japanese punctuation marks ALchar standing for all other characters like latin alphabets We say alphabetic fonts for fonts used in ALchar and Japanese fonts for fonts used in JAchar A word in a sans serif font like prebreakpenalty means an internal parameter for Japanese typeset ting and it is used as a key in lt jsetparameter command e A word in typewriter font with underline like fontspec means a package or a class of IATEX In this document natural numbers start from zero denotes the set of all natural numbers 1 4 About the Project MProject Wiki Project Wiki is under construction e http sourceforge jp projects luatex ja wiki FrontPage 28en 29 English e http sourceforge jp projects luatex ja wiki FrontPage Japanese e http sourceforge jp projects luatex ja wiki FrontPage 28zh 29 Chinese This project is hosted by SourceForge JP Mi Members e Hironori KITAGAWA e Kazuki MAEDA e Takayuki YATO e Yusuke KUROKI e Noriyuki ABE e Munehiro YAMAMOTO e Tomoaki HONDA e Shuzaburo SAITO e MA Qiyuan 2 Getting Started 2 1 Installation To install the LuaTEX ja package you will need the following engine and packages LuaTpX beta 0 74 0 or later luaotfload v2 2 or later luatexbase
66. rameters 7 ltjsetparameter 7 2 ltjgetparameter 7 3 ltjsetkanjiskip ltjsetxkanjiskip DO Q tn MN BWW W Oo on Nl 11 11 13 13 14 14 15 15 15 16 16 16 18 19 21 22 8 Other Commands for plain TEX and IEX 2 8 1 Commands for Compatibility with pIEX 8 2 inhibitglue 83 ltjdeclarealtfont 9 Commands for BIFX 2 9 1 Patch for NFSS2 10 Addons 10 1 luatexja fontspec sty 10 2 luatexja otf sty 10 3 luatexja adjust sty 10 4 luatexja ruby sty III Implementations 11 Storing Parameters 11 1 Used Dimensions Attributes and Whatsit Nodes 11 2 Stack System of LuaTgX ja 11 3 Lua Functions of the Stack System 11 4 Extending Parameters 12 Linebreak after a Japanese Character 12 1 Reference Behavior in pIEX 12 2 Behavior in LuaTEX ja 13 Patch for the listings Package 13 1 Notes 13 2 Class of Characters 14 Cache Management of LuaT X ja 14 1 Use of Cache 14 2 Internal References A Package versions used in this document 26 26 26 27 27 27 29 29 30 31 31 32 32 32 33 34 34 35 35 35 37 37 37 38 38 39 39 41 This documentation is far from complete It may have many grammatical and contextual errors Also several parts are written in Japanese only Part I User s manual 1 Introduction The LuaTpx ja package is a macro package for typesettin
67. s Uni JIS2004 UTF32 H and Adobe Japan1 UCS2 and this is why these two CMaps are needed in the first run of LuaTEX ja Similar caches are created as Table 8 if you specified cid key in jfont to use other CID keyed non embedded fonts for Chinese or Korean as in Page 18 ivs lua This file stores the table of Unicode variants in a font The structure of the table is the following 38 Table 8 cid key and corresponding files cid key name of the cache used CMaps Adobe Japani 1tj cid auto adobe japani lua UniJIS2004 UTF32 H Adobe Japani UCS2 Adobe Koreai 1tj cid auto adobe koreal lua UnikS UTF32 H Adobe Koreai UCS2 Adobe GB1 1tj cid auto adobe gb1 lua UniGB UTF32 H Adobe GB1 UCS2 Adobe CNS1 1tj cid auto adobe cns1 lua UniCNS UTF32 H Adobe CNS1 UCS2 return 10955 U 2ACB Subset Of Above Not Equal To 65024 983879 lt 2ACB FEO0 37001 U 9089 iE 0 237001 9089 E0100 991049 9089 E0101 gt chksum FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF checksum of the fontfile version 4 version of the cache 1tj jisx0208 luc lub The binary version of 1tj jisx0208 1lua This is the conversion table be tween JIS X 0208 and Unicode which is used in Kanji code conversion commands for compatibility with pIEX 14 2 Internal Cache management system of LuaTpX ja is stored in luatexja base 1tj base lua There are three public functions for cache management in lu
68. st which does not contain Range key is simply ig nored A demonstrartion is shown in Figure 5 10 2 luatexja otf sty This optional package supports typesetting characters in Adobe Japan1 character collection or other CID character collecton if the font is supported The package luatexja otf offers the following 2 low level commands CID number Typeset a character whose CID number is number UTF hex_number Typeset a character whose character code is hex_number in hexadecimal This command is similar to char hex number but please remind remarks below MRemarks Characters by CID and NUTF commands are different from ordinary characters in the follow ing points Always treated as JAchars Processing codes for supporting OpenType features e g glyph replacement and kerning by the luaotfload package is not performed to these characters llAdditional syntax of JFM The package luatexja otf extends the syntax of JFM the entries of chars table in JFM now allows a string in the form AJ1 xxx which stands for the character whose CID number in Adobe Japanl is xxx This extened notation is used in the standard JFM jfm ujis lua to typeset halfwidth Hiragana glyphs CID 516 598 in halfwidth MIVS support Recent fonts support Ideographic Variation Selector IVS It seems that luaotfload and fontspec packages do not support IVS so we implemented IVS support in luatexja otf IVS support is experimental if you want t
69. that the heavy weight of gothic family only supports Adobe Japan1 3 character collection Std StdN family series hiragino pro hiragino pron pee medium Hiragino Mincho Pro W3 Hiragino Mincho ProN W3 bold Hiragino Mincho Pro W6 Hiragino Mincho ProN W6 di Hiragino Kaku Gothic Pro W3 Hiragino Kaku Gothic ProN W3 i Hiragino Kaku Gothic Pro W6 Hiragino Kaku Gothic ProN W6 gothic bold Hiragino Kaku Gothic Pro W6 Hiragino Kaku Gothic ProN W6 heavy Hiragino Kaku Gothic Std W8 Hiragino Kaku Gothic StdN W8 rounded gothic Hiragino Maru Gothic ProN W4 Hiragino Maru Gothic ProN W4 morisawa pro Morisawa Pro Adobe Japan 1 4 fonts morisawa pr6n Morisawa Pr N Adobe Japan1 6 JIS04 savvy fonts family series morisawa pro morisawa pr6n w nrho medium A OTF RyuminPro Light otf A OTF RyuminPr6N Light otf bold A OTF FutoMinA101Pro Bold otf A OTF FutoMinA101Pr6N Bold otf medium A OTF GothicBBBPro Medium otf A OTF GothicBBBPr6N Medium otf gothic bold A OTF FutoGoB101Pro Bold otf A OTF FutoGoB101Pr6N Bold otf heavy A OTF MidashiGoPro MB31 otf A OTF MidashiGoPr6N MB31 otf rounded gothic A OTF Jun101Pro Light otf A OTF ShinMGoPr6N Light otf yu win Yu fonts bundled with Windows 8 1 yu osx Yu fonts bundled with OSX Mavericks family series yu win yu osx OPNS medium YuMincho Regular YuMincho Medium bold YuMincho Demibold YuMincho Demibold mediiti YuGothic Regular YuGothic Medium YuGothic Bold YuGothic Bold gothic bold Y
70. tical typesetting is supported by LuaTpX ja in the future JT3 will be used for vertical fonts Uni JIS2004 UTF32 H and Adobe Japan1 UCS2 Traditionally Japanese documents use two typeface category mincho HHER A and gothic 17 Y 948 mincho is used in the main text while gothic is used in the headings or for emphasis classification family name mincho HAHA textmc mcfamily mcdefault gothic dz Y JF textgt iNgtfamily gtdefault By default the following fonts are used for mincho and gothic classification family name mdseries bfseries scale mincho HARA mc Ryumin Light GothicBBB Medium 0 962216 gothic AY Y 74 gt GothicBBB Medium GothicBBB Medium 0 962216 Note that the bold series in both family are same as the medium series of gothic family This is a con vention in pIATEX This is trace that there were only 2 fonts these are Ryumin Light and GothicBBB Medium in early years of DTP There is no italic nor slanted shape for these mc and gt Japanese characters in math mode are typeset by the font family mc However above settings are not sufficient for Japanese based documents To typeset Japanese based documents you are better to use class files other than article cls book cls and so on At the present we have the counterparts of jclasses standard classes in plATEX and jsclasses classes by Haruhiko Okumura namely 1t jclasses and 1tjsclasses 3 Changing Fonts
71. trol word is controlled by setting Ncatcode to 11 enabled or 12 disabled as usual Whether jcharwidowpenalty can be inserted before the character is controlled by the lowermost bit of the kcatcode parameter Ignoring linebreak after a JAchar is always ignored Default setting of catcode of LuaTEX can be found in luatex unicode letters tex which is based on unicode letters tex for XqIpX However the default setting of Ncatcode differs between XHTEX and Lua TEX by the following reasons luatex unicode letters tex is based on old unicode letters tex The latter half of unicode letters tex sets Ncatcode of Kanji and kana characters to 11 via setting XeTeXcharclass However this latter half is simply omitted in luatex unicode letters tex hence catcode of Kanji and kana characters remains 12 in LuaTEX In other words Kanji nor kana characters cannot be used in a control word in the default setting of LuaTpX This would be inconvenient for pIEX users to shifting to LuaTpxX ja since several control words contain ing Kanji such as AJS are used in pIEX Hence LuaTpX ja have a counterpart ofunicode letters tex for Lua TEX to match the catcode setting with that of XqlEX JupIgX divides U FFOO U FFEF Halfwidth and Fullwidth Forms into three subblocks and kcatcode can be set by a subblock 15 Table 5 Difference of the set of non kanji JIS X 0208 characters which can be used in a control word
72. ttributes store bit vec tors indicating which character block is regarded as a block of JAchars Furthermore LuaTpEX ja uses several user defined whatsit nodes for inrernal processing All those nodes store a natural number hence the node s type is 100 Their user id used for distinguish user defined whatsits are allocated by luatexbase newuserwhatsitid inhibitglue Nodes for indicating that inhibitglue is specified The value field of these nodes doesn t matter stack marker Nodes for LuaTpEX ja s stack system see the next subsection The value field of these nodes is current group level char by cid Nodes for JAchar which the callback process of 1uaotfload won t be applied and the char acter code is stored in the value field Each node of this type are converted to a glyph node after the callback process of luaotfload Nodes of this type is used in NCID NUTF and IVS support replace vs Similar to char by cid whatsits above These nodes are for ALchar which the callback process of luaotfload won t be applied begin par Nodes for indicating beginning of a paragraph A paragraph which is started by item in list like environments has a horizontal box for its label before the actual contents So These whatsits will be removed during the process of inserting JAglues 11 2 Stack System of LuaTpx ja liBackground LuaTpX ja has its own stack system and most parameters of LuaTEX ja are stored in it To clarify the reason imag
73. uGothic Bold YuGothic Bold heavy YuGothic Bold YuGothic Bold rounded gothic YuGothic Bold YuGothic Bold MPresets for single weight Next we describe settings for using only single weight In four settings be low we use same fonts for medium and bold and heavy weights Hence mcfamily bfseries and ncfamily mdseries yields same Japanese fonts even if deluxe option is also specified noembed ipa ipaex ms mincho Ryumin Light non embedded IPAMincho IPAexMincho MS Mincho gothic GothicBBB Medium non embedded IPAGothic IPAexGothic MS Gothic 10 N Ian a w MUsing HG fonts We can use HG fonts bundled with Microsoft Office for realizing multiple weights ipa hg ipaex hg ms hg mincho medium IPAMincho IPAexMincho MS Mincho mincho bold HG Mincho E Gothic medium without deluxe IPAGothic IPAexGothic MS Gothic with jis2004 IPAGothic IPAexGothic MS Gothic otherwise HG Gothic M gothic bold HG Gothic E gothic heavy HG Soei Kaku Gothic UB rounded gothic HG Maru Gothic PRO Note that HG Mincho E HG Gothic E HG Soei Kaku Gothic UB and HG Maru Gothic PRO are internally specified by default by font name HGMinchoE etc 90jis by filename hgrme ttc hgrge ttc hgrsgu ttc hgrsmp ttf jis2004 by filename hgrme04 ttc hgrge04 ttc hgrsgu04 ttc hgrsmp04 ttf 3 4 CID UTF and macros in japanese otf package Under pIATEX japanese otf package developed by Shuzaburo Saito is used for typesetting
74. up level for the TEX s group level when the last assignment was done Parameters are stored in one big table named charprop stack table where charprop stack table i stores data of stack level i If a new stack level is created by ltjsetparameter all data of the previous level is copied To resolve the problem mentioned in above paragraph Background LuaTpX ja uses another trick When the stack level is about to be increased a whatsit node whose type subtype and value are 44 user defined stack marker and the current group level respectively is appended to the current list we refer this node by stack flag This enables us to know whether assignment is done just inside a hbox Suppose that the stack level is s and the TEX s group level is t just after the hbox group then e f there is no stack flag node in the list of the contents of the hbox then no assignment was occurred inside the hbox Hence values of parameters at the end of the hbox are stored in the stack level s e If there is a stack flag node whose value is t 1 then an assignment was occurred just inside the hbox group Hence values of parameters at the end of the hbox are stored in the stack level s 4 1 If there are stack flag nodes but all of their values are more than t 1 then an assignment was occurred in the box but it is done in more internal group Hence values of parameters at the end of the hbox are stored in the stack level s Note that to work this tr
75. v0 6 or later everysel vl 2 or later xunicode v0 981 2011 09 09 adobemapping Adobe cmap and pdfmapping files This version of Lua TEX ja no longer supports TEX Live 2012 or older version since LuaT X binary and Luaot f load is updated in TEX Live 2013 Now LuaTpX ja is available from the following archive and distributions CTAN in the macros luatex generic luatexja directory MiKT X in luatexja tar 1zma see the next subsection TEX Live in texmf dist tex luatex luatexja W32T X in luatexja tar xz If you are using TEX Live 2014 you can install Lua TEX ja from TEX Live manager t1mgr tlmgr install luatexja M Manual installation 1 5 Download the source archive by one of the following method At the present LuaT X ja has no stable release Copy the Git repository git clone git git sourceforge jp gitroot luatex ja luatexja git e Download the tar gz archive of HEAD in the master branch from http git sourceforge jp view p luatex ja luatexja git a snapshot h HEAD sf tgz Note that the master branch and hence the archive in CTAN are not updated frequently the forefront of development is not the master branch Extract the archive You will see src and several other sub directories But only the contents in src are needed to work LuaTpx ja If you downloaded this package from CTAN you have to run following commands to generate classes and 1tj kinsoku 1ua the file which st
Download Pdf Manuals
Related Search
Related Contents
Partnernet Faxer Fax Server User's Guide PT-F300NTE PT-F300E ESTERILIZADOR A VAPOR POR ALTO VACO MANUAL DO UTILIZADOR ResMed 2i User's Manual Pyle PLMP4C4 FM transmitter Targus Click In KWC QBIX/QBIX-ART 26.240.502.000 User's Manual 取扱説明書 CDA HCG301SS hob Copyright © All rights reserved.
Failed to retrieve file