diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty new file mode 100644 index 00000000000..d7d01c820ec --- /dev/null +++ b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty @@ -0,0 +1,124 @@ +%% +%% This is file `zhlipsum.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% zhlipsum.dtx (with options: `package') +%% +%% Copyright (C) 2017 by Xiangdong Zeng <pssysrq@163.com> +%% +%% 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. 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 Xiangdong Zeng. +%% +%% This work consists of the files zhlipsum.dtx +%% zhlipsum.ins +%% README.md +%% and the derived files zhlipsum.pdf +%% zhlipsum.sty +%% zhlipsum-zh-cn.def. +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3,xparse} +\GetIdInfo $Id: zhlipsum.dtx 0.3 2017-07-28 12:00:00Z Xiangdong Zeng $ + {Chinese dummy text} +\ProvidesExplPackage{\ExplFileName} + {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\str_new:N \l__zhlipsum_tmpa_str +\str_new:N \l__zhlipsum_lang_code_str +\str_const:Nn \c__zhlipsum_text_cs_prefix { c__zhlipsum_text_ } +\str_const:Nn \c__zhlipsum_text_cs_suffix { _tl } +\int_const:Nn \c__zhlipsum_max_par_number_int { 50 } +\cs_new:Npn \__zhlipsum_print_single:N #1 + { + \str_set:Nx \l__zhlipsum_tmpa_str + { \int_to_roman:n { #1 } } + \str_set:Nn \l__zhlipsum_lang_code_str + { zh_cn_ } + \str_put_left:Nx \l__zhlipsum_tmpa_str + \l__zhlipsum_lang_code_str + \str_put_left:Nx \l__zhlipsum_tmpa_str + \c__zhlipsum_text_cs_prefix + \str_put_right:Nx \l__zhlipsum_tmpa_str + \c__zhlipsum_text_cs_suffix +%% Print paragrapf number string. For debug. + \use:c { \str_use:N \l__zhlipsum_tmpa_str } + } +\int_new:N \l__zhlipsum_begin_int +\int_new:N \l__zhlipsum_end_int +\int_new:N \l__zhlipsum_step_int +\cs_new:Npn \__zhlipsum_process_par_number:nn #1 #2 + { + \int_compare:nTF { #1 <= \c__zhlipsum_max_par_number_int } + { \int_set:Nn \l__zhlipsum_begin_int { #1 } } + { + \int_set_eq:NN \l__zhlipsum_begin_int + \c__zhlipsum_max_par_number_int + } + \IfNoValueTF { #2 } + { + \int_set_eq:NN \l__zhlipsum_end_int + \l__zhlipsum_begin_int + } + { + \int_compare:nTF { #2 <= \c__zhlipsum_max_par_number_int } + { \int_set:Nn \l__zhlipsum_end_int { #2 } } + { + \int_set_eq:NN \l__zhlipsum_end_int + \c__zhlipsum_max_par_number_int + } + } + \int_compare:nTF + { \l__zhlipsum_begin_int <= \l__zhlipsum_end_int } + { \int_set_eq:NN \l__zhlipsum_step_int \c_one } + { \int_set:Nn \l__zhlipsum_step_int { -1 } } + } +\cs_new:Npn \zhlipsum_print_multi_par:nn #1 #2 + { + \__zhlipsum_process_par_number:nn { #1 } { #2 } + \int_step_inline:nnnn + { \l__zhlipsum_begin_int } + { \l__zhlipsum_step_int } + { \l__zhlipsum_end_int } + { + \__zhlipsum_print_single:N { ##1 } + \par + } + } +\cs_new:Npn \zhlipsum_print_multi_no_par:nn #1 #2 + { + \__zhlipsum_process_par_number:nn { #1 } { #2 } + \int_step_inline:nnnn + { \l__zhlipsum_begin_int } + { \l__zhlipsum_step_int } + { \l__zhlipsum_end_int } + { + \__zhlipsum_print_single:N { ##1 } + } + } +\NewDocumentCommand \zhlipsum + { s >{ \SplitArgument { 1 } { - } } O{ 1 - 3 } } + { + \par + \IfBooleanTF { #1 } + { + \zhlipsum_print_multi_no_par:nn #2 + \par + } + { \zhlipsum_print_multi_par:nn #2 } + } +\file_input:n { zhlipsum-zh-cn.def } +\endinput +%% +%% End of file `zhlipsum.sty'. |