From 8df04d2bc586fbc29522411fd5e747cdc9b83f6c Mon Sep 17 00:00:00 2001 From: Qing Lee Date: Sat, 14 May 2016 12:21:18 +0800 Subject: [PATCH] =?UTF-8?q?xCJK2uni:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E6=A0=BC=E5=BC=8F=EF=BC=8C=E5=BA=94=E7=94=A8=20ctxdoc?= =?UTF-8?q?=20=E5=92=8C=20ctxdocstrip=EF=BC=8CREADME=20=E6=94=B9=E6=88=90?= =?UTF-8?q?=20md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xCJK2uni/build.lua | 5 +- xCJK2uni/xCJK2uni.dtx | 333 +++++++++++++----------------------------- 2 files changed, 101 insertions(+), 237 deletions(-) diff --git a/xCJK2uni/build.lua b/xCJK2uni/build.lua index 3824f5ec..e2320b7b 100644 --- a/xCJK2uni/build.lua +++ b/xCJK2uni/build.lua @@ -6,7 +6,8 @@ packtdszip = true sourcefiles = {"xCJK2uni.dtx"} unpackfiles = {"xCJK2uni.dtx"} -unpacksuppfiles = {"xCJK2uni.ver"} +unpacksuppfiles = {"xCJK2uni.id", "ctxdocstrip.tex"} +typesetsuppfiles = {"ctxdoc.cls"} installfiles = {"*.sty", "xCJK2uni-U*.def", "*.cmap"} unpackexe = "luatex" typesetexe = "xelatex" @@ -16,7 +17,7 @@ subtexdirs = { } function copytds_posthook() - -- ins 文件 + cp("xCJK2uni.ins", unpackdir, ctandir .. "/" .. ctanpkg) cp("xCJK2uni.ins", unpackdir, tdsdir .. "/source/" .. moduledir) end diff --git a/xCJK2uni/xCJK2uni.dtx b/xCJK2uni/xCJK2uni.dtx index d2f81d81..e2a34209 100644 --- a/xCJK2uni/xCJK2uni.dtx +++ b/xCJK2uni/xCJK2uni.dtx @@ -4,83 +4,77 @@ \iffalse % %<*readme> -Introduction ------------- +xCJK2uni +======== + The `xCJK2uni` package provides commands to convert CJK character to Unicode in non-UTF-8 encoding. It provides hooks for `hyperref` to get the correct bookmarks. -It also provides some /ToUnicode mapping file for CJK subfont. They can be used +It also provides some `/ToUnicode` mapping file for CJK subfont. They can be used with `cmap` package and make CJK character searchable and copyable in PDF files generated by pdfLaTeX. -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this license or -(at your option) any later version. The latest version of this license is in +Basic Usage +----------- - http://www.latex-project.org/lppl.txt +The package provides the following macros: -and version 1.3 or later is part of all distributions of LaTeX version -2005/12/01 or later. + \useCJKencmap{} -This work has the LPPL maintenance status "maintained". -The Current Maintainer of this work is Qing Lee. +Set the current encoding. The default encoding is GBK. -This work consists of the file xCJK2uni.dtx, - and the derived files xCJK2uni.pdf, - xCJK2uni.sty, - xCJK2uni.ins, - xCJK2uni-make.tex, - xCJK2uni-sfd.def, - xCJK2uni-UBg5plus.def, - xCJK2uni-UBig5.def, - xCJK2uni-UGB.def, - xCJK2uni-UGBK.def, - xCJK2uni-UJIS.def, - xCJK2uni-UKS.def, - c****.cmap, and - README (this file). + \CJKchartouni{} -Basic Usage ------------ -The package provides the following macros: - - \useCJKencmap{} - Set the current encoding. The default encoding is GBK. +Convert a single CJK character to its Unicode. +It requires two steps of expansion. - \CJKchartouni{} - Convert a single CJK character to its Unicode. - It requires two steps of expansion. + \CJKsfdtouni{}{} - \CJKsfdtouni{}{} - Convert the .sfd coordinate to its Unicode. - It requires two steps of expansion. +Convert the .sfd coordinate to its Unicode. +It requires two steps of expansion. You can read the package manual (in Chinese) for more detailed explanations. -Author ------- -Qing Lee -Email: sobenlee@gmail.com +Contributing +------------ -If you are interested in the process of development you may observe +This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project. - https://github.com/CTeX-org/ctex-kit +Issues and pull requests are welcome. -Installation ------------- -The package is supplied in dtx format and as a pre-extracted zip file, -xCJK2uni.tds.zip. The later is most convenient for most users: simply -unzip this in your local texmf directory and run texhash to update the -database of file locations. If you want to unpack the dtx yourself, -running "luatex xCJK2uni.dtx" will extract the package whereas -"xelatex xCJK2uni.dtx" will typeset the documentation. +Copyright and Licence +--------------------- -The package requires LaTeX3 support as provided in the l3kernel. -It is available on CTAN as ready-to-install zip files. -Suitable versions are available in the latest version of MiKTeX and TeX Live -(updating the relevant packages online may be necessary). + Copyright (C) 2013-2014, 2016 by Qing Lee + ---------------------------------------------------------------------- -To compile the documentation without error, you will need the xeCJK package -and some specific Chinese Simplified fonts. + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Qing Lee. + + This package consists of the file xCJK2uni.dtx, + and the derived files xCJK2uni.pdf, + xCJK2uni.sty, + xCJK2uni.ins, + xCJK2uni-make.tex, + xCJK2uni-sfd.def, + xCJK2uni-UBg5plus.def, + xCJK2uni-UBig5.def, + xCJK2uni-UGB.def, + xCJK2uni-UGBK.def, + xCJK2uni-UJIS.def, + xCJK2uni-UKS.def, + c****.cmap, and + README.md (this file). % %<*internal> \fi @@ -91,96 +85,62 @@ and some specific Chinese Simplified fonts. % %<*install> -\newread\inputcheck -\openin\inputcheck=xCJK2uni.ver -\ifeof\inputcheck - \expandafter\def\csname xCJK2uniPutVersion\endcsname{\string\GetIdInfo$Id$} -\else - \input xCJK2uni.ver -\fi -\closein\inputcheck - -\input l3docstrip.tex - -\def\checkOption<#1{% - \ifcase - \ifx*#10\else \ifx/#11\else - \ifx+#12\else \ifx-#13\else - \ifx<#14\else \ifx @#15\else - \ifx.#16\else - 7\fi\fi\fi\fi\fi\fi\fi\relax - \expandafter\starOption\or - \expandafter\slashOption\or - \expandafter\plusOption\or - \expandafter\minusOption\or - \expandafter\verbOption\or - \expandafter\moduleOption\or - \expandafter\expOption\or - \expandafter\doOption\fi - #1% -} -\def\expOption .#1>#2\endLine{% - \maybeMsg{<.#1 . >}% - \Evaluate{#1}% - \begingroup - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\ =10 - \xdef\expandedLineStuff{\scantokens{#2\noexpand}}% - \endgroup - \def\do##1##2##3{% - \if1\Expr{##2}\StreamPut##1{\expandedLineStuff}\fi - }% - \activefiles -} +\input ctxdocstrip % -\keepsilent -\askforoverwritefalse \preamble - Copyright (C) 2013-2014, 2016 by Qing Lee + Copyright (C) 2013-2014, 2016 by Qing Lee -------------------------------------------------------------------------- - This work may be distributed and/or modified under the - conditions of the LaTeX Project Public License, either version 1.3 - of this license or (at your option) any later version. - The latest version of this license is in - http://www.latex-project.org/lppl.txt - and version 1.3 or later is part of all distributions of LaTeX - version 2005/12/01 or later. - This work has the LPPL maintenance status "maintained". - The Current Maintainer of this work is Qing Lee. + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Qing Lee. + +-------------------------------------------------------------------------- \endpreamble \postamble - This package consists of the file xCJK2uni.dtx, - and the derived files xCJK2uni.pdf, - xCJK2uni.sty, - xCJK2uni.ins, - xCJK2uni-make.tex, - xCJK2uni-sfd.def, - xCJK2uni-UBg5plus.def, - xCJK2uni-UBig5.def, - xCJK2uni-UGB.def, - xCJK2uni-UGBK.def, - xCJK2uni-UJIS.def, - xCJK2uni-UKS.def, - c****.cmap, and - README. -\endpostamble - -\declarepostamble\emptypostamble + This package consists of the file xCJK2uni.dtx, + and the derived files xCJK2uni.pdf, + xCJK2uni.sty, + xCJK2uni.ins, + xCJK2uni-make.tex, + xCJK2uni-sfd.def, + xCJK2uni-UBg5plus.def, + xCJK2uni-UBig5.def, + xCJK2uni-UGB.def, + xCJK2uni-UGBK.def, + xCJK2uni-UJIS.def, + xCJK2uni-UKS.def, + c****.cmap, and + README.md. \endpostamble \generate { +% +%<*internal> \usedir{source/latex/xcjk2uni} \file{xCJK2uni.ins} {\from{\jobname.dtx}{install}} +% +%<*install> \usedir{tex/latex/xcjk2uni} \file{xCJK2uni.sty} {\from{\jobname.dtx}{package}} \file{xCJK2uni-make.tex} {\from{\jobname.dtx}{make}} \nopreamble\nopostamble \usedir{doc/latex/xcjk2uni} - \file{README.txt} {\from{\jobname.dtx}{readme}} + \file{README.md} {\from{\jobname.dtx}{readme}} } \let\input\@@input @@ -229,22 +189,14 @@ and some specific Chinese Simplified fonts. %<*internal> \fi % -% -%<*driver|package|make|def> -%<*!(make|def)> -\NeedsTeXFormat{LaTeX2e} -\RequirePackage{expl3} -% +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} %\input expl3-generic % -%<.!driver>\csname xCJK2uniPutVersion\endcsname +%<+package|make|def>\GetIdInfo$Id$ +% {Convert CJK character to Unicode.} %<*driver> -\InputIfFileExists{xCJK2uni.ver}{}{ - \expandafter\def\csname xCJK2uniGetVersionInfo\endcsname{\GetIdInfo$Id$}} -\csname xCJK2uniGetVersionInfo\endcsname - {xCJK2uni source file} -\ProvidesExplFile{\ExplFileName.\ExplFileExtension} +\def\ctxaux#1#2#3{\def\ctxversion{v#2}}\ctxaux % -% {Convert CJK character to Unicode.} %\ProvidesExplPackage{\ExplFileName} %\ExplSyntaxOn %\cs_if_exist:NF \ProvidesExplFile @@ -261,114 +213,25 @@ and some specific Chinese Simplified fonts. %\ProvidesExplFile{xCJK2uni-UGBK.def} %\ProvidesExplFile{xCJK2uni-UJIS.def} %\ProvidesExplFile{xCJK2uni-UKS.def} - {\ExplFileDate}{0.5}{\ExplFileDescription} +%<*driver|package|make|def> + {\ExplFileDate}{0.6}{\ExplFileDescription} % %<*driver> -\ExplSyntaxOff -\let\ctexrevnum\ExplFileVersion -\expandafter\let\csname ver@thumbpdf.sty\endcsname\fmtversion -\documentclass[numbered,full,a4paper]{l3doc} -\usepackage{xeCJK} -\usepackage{indentfirst} -\usepackage{geometry} -\hypersetup{pdfstartview=FitH} -\geometry{includemp,hmargin={0mm,15mm},vmargin=15mm,footskip=7mm} -\linespread{1.1} -\setmainfont{TeX Gyre Pagella} -\setsansfont{CMU Sans Serif} -\setmonofont[ - UprightFont=* Light, BoldFont=* Bold, - SlantedFont=* Light Oblique]{CMU Typewriter Text} -\setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std} -\setCJKmonofont{Adobe Kaiti Std} -\xeCJKsetup{PunctStyle=kaiming} -\def\MacroFont{\linespread{1}\small\normalfont\ttfamily} -\def\ctexkitrev#1{% - \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}} -\makeatletter -\ExplSyntaxOn -\DeclareDocumentCommand \package { o m } - { - \exp_args:Nx \href - { - http \token_to_str:N : //www.ctan.org/pkg/ - \IfNoValueTF {#1} { \str_fold_case:n {#2} } {#1} - } - { \pkg {#2} } - } -\cs_set_protected:Npn \__codedoc_special_index_aux:nnnnn #1#2#3#4#5 - { - \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2} - \str_if_eq:onTF { \@currenvir } { macrocode } - { \codeline@wrindex } - { - \HD@target - \index - } - { - \tl_if_empty:nF { #3 #4 } - { #3 \actualchar #4 \levelchar } - #1 - \actualchar - { - \token_to_str:N \verbatim@font \c_space_tl - \l__codedoc_index_escaped_macro_tl - } - \encapchar - hdclindex{\the\c@HD@hypercount}{#5} - } - } -\DeclareDocumentCommand \cs { O{} m } - { \__codedoc_cmd_aux:no {#1} { \c__codedoc_backslash_tl #2 } } -\DeclareDocumentCommand \tn { O{} m } - { - \__codedoc_cmd_aux:no - { index = TeX , replace = false , #1 } - { \c__codedoc_backslash_tl #2 } - } -\DeclareDocumentCommand \meta { +m } - { \__codedoc_meta_aux:n {#1} } -\DeclareExpandableDocumentCommand \bookmarkcstn { O{} m } - { \tl_to_str:n {#2} } -\cs_new:Npn \bookmarkmeta #1 { < \tl_to_str:n {#1} > } -\cs_generate_variant:Nn \__codedoc_cmd_aux:nn { no } -\AtBeginEnvironment { syntax } - { - \char_set_catcode_active:N \| - \char_set_active_eq:NN \| \orbar - } -\ExplSyntaxOff -\makeatother -\pdfstringdefDisableCommands{% - \let\cs\bookmarkcstn - \let\tn\bookmarkcstn - \let\meta\bookmarkmeta - \let\path\detokenize} -\def\TeX{\hologo{TeX}} -\def\LaTeX{\hologo{LaTeX}} -\def\pdfTeX{\hologo{pdfTeX}} -\def\pdfLaTeX{\hologo{pdfLaTeX}} -\def\orbar{\textup{\textbar}} -\def\indexname{代码索引} -\IndexPrologue{% - \section*{\indexname} - \markboth{\indexname}{\indexname} - 斜体的数字表示对应项说明所在的页码,下划线的数字表示定义所在的代码行号,而直立体的 - 数字表示对应项使用时所在的行号。} +\documentclass{ctxdoc} \begin{document} \DocInput{\jobname.dtx} - \newgeometry{margin=15mm,footskip=7mm} + \IndexLayout \PrintIndex \end{document} % % \fi % % \CheckSum{612} -% \GetFileInfo{\jobname.dtx} +% \GetFileId{xCJK2uni.sty} % % \title{\bfseries\pkg{xCJK2uni} 宏包} % \author{李清\\ \path{sobenlee@gmail.com}} -% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ctexrevnum}.}} +% \date{\ExplFileDate\qquad\ctxversion\thanks{\ctexkitrev{\ExplFileVersion}.}} % \maketitle % % \begin{documentation}