diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-22 23:02:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-22 23:02:14 +0000 |
commit | 7925857aaa072c8a2029848c3b9c5a480fd8cc87 (patch) | |
tree | bd092ec6d27f72f8065174ae479fa2cbd7766fe2 /Master/texmf-dist/tex/latex/copyedit | |
parent | c7fbeeaff8d1548d8bb4dc7e3e4dd49846d0e974 (diff) |
copyedit (22jul15)
git-svn-id: svn://tug.org/texlive/trunk@37928 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/copyedit')
-rw-r--r-- | Master/texmf-dist/tex/latex/copyedit/copyedit.sty | 329 |
1 files changed, 329 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/copyedit/copyedit.sty b/Master/texmf-dist/tex/latex/copyedit/copyedit.sty new file mode 100644 index 00000000000..d504a683cea --- /dev/null +++ b/Master/texmf-dist/tex/latex/copyedit/copyedit.sty @@ -0,0 +1,329 @@ +%% +%% This is file `copyedit.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% copyedit.dtx (with options: `package') +%% --------------------------------------------------------------- +%% The copyedit package --- Copyediting support in LaTeX documents +%% Maintained by CV Radhakrishnan, CV Rajagopal and SK Venkatesan +%% E-mail: <cvr@cvr.cc>, <cvr3@cvr.cc> and <skvenkat@tnq.co.in> +%% Released under the LaTeX Prlject Public Licence v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% --------------------------------------------------------------- +%% +%% +%% This is file 'copyedit.dtx' +%% ........................... +%% +%% (c) 2014,2015, +%% CV Radhakrishnan <cvr@cvr.cc>, JWRA 34, Jagathy, +%% Trivandrum 695014, India +%% CV Rajagopal <cvr3@cvr.cc>, SRA 34C, Elipode, +%% Vattiyoorkavu, Trivandrum 695013, India +%% SK Venkatesan <skvenkat@tnq.co.in>, TNQ Books and Journals +%% Pvt Ltd, Kottivakkam, Chennai 600041, India +%% +%% 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 the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% The list of all files belonging to the 'copyedit' is +%% given in the file `manifest.txt'. +%% +\RequirePackage{expl3}[2014/07/20] +\@ifpackagelater{expl3}{2014/07/20} + {} + {% + \PackageError{copyedit}{Support package l3kernel too old} + {% + Please install an up to date version of l3kernel\MessageBreak + using your TeX package manager or from CTAN.\MessageBreak + \MessageBreak + Loading copyedit will abort!% + }% + \endinput + } +\RequirePackage{acronym,l3str,l3keys2e,xparse} +%%%% $Id: copyedit.dtx,v 1.6 2015/07/21 07:27:11 cvr Exp cvr $ +\GetIdInfo$Id: copyedit.dtx,v 1.6 2015-07-21 07:27:11 cvr Exp cvr $ + {TeX and Copyediting (CVR)} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\msg_new:nnnn { copyedit } { incompatible-package } + { Package~'#1'~incompatible. } + { The~#1~package~and~copyedit~are~incompatible. } +\cs_new_protected:Npn \__cedt_load_check:n #1 + { + \group_begin: + \@ifpackageloaded {#1} + { \msg_error:nnx { copyedit } { incompatible-package } {#1} } + { } + \group_end: + } +\clist_map_function:nN + { Array , MyPackage } + \__cedt_load_check:n +\AtBeginDocument { + \clist_map_function:nN { Array , MyPackage } + \__cedt_load_check:n + } +\NewDocumentCommand \wrAux { m } + { \iow_now:Nx \@auxout { #1 } } +\int_new:N \l__cedt_lat_int +\NewDocumentCommand \setlat { m } + { \int_set:Nn \l__cedt_lat_int { #1 } } + +\int_new:N \l__cedt_pc_int +\NewDocumentCommand \setpc { m } + { \int_set:Nn \l__cedt_pc_int { #1 } } + +\int_new:N \l__cedt_lang_int +\NewDocumentCommand \setlang { m } + { \int_set:Nn \l__cedt_lang_int { #1 } } + +\int_new:N \l__cedt_eitem_int +\NewDocumentCommand \seteitem { m } + { \int_set:Nn \l__cedt_eitem_int { #1 } } +\int_new:N \l__cedt_abbr_int + +\NewDocumentCommand \setabbr { m } + { + \str_if_eq:nnTF { #1 } { italic } + { \int_set:Nn \l__cedt_abbr_int { 0 } } + { \int_set:Nn \l__cedt_abbr_int { 1 } } + } +\cs_new_protected:Npn \__cedt_lang_check:n #1 + { + \str_if_eq:nnT { #1 } { uk } { \setlang { 0 } } + \str_if_eq:nnT { #1 } { us } { \setlang { 1 } } + \str_if_eq:nnT { #1 } { ca } { \setlang { 2 } } + \str_if_eq:nnT { #1 } { au } { \setlang { 3 } } + } +\keys_define:nn { copyedit } + { + lang .code:n = \__cedt_lang_check:n { #1 } , + lat .code:n = \setlat { #1 } , + abbr .code:n = \setabbr{ #1 } , + pc .code:n = \setpc { #1 } , + draft .bool_set:N = \l__cedt_draft_bool , + last .bool_set:N = \l__cedt_last_bool , + eitem .code:n = \seteitem { #1 } , + key-unknown .code:n = + { + \msg_error:nnx { copyedit } { unknown-option } + { \exp_not:V \l_keys_key_tl } + } + } +\keys_set:nn { copyedit } + { + lang = { uk } , + lat = { 0 } , + abbr = { italic } , + pc = { 0 } , + draft = { false } , + last = { false } , + eitem = { 0 } , + } + +\ProcessKeysOptions { copyedit } +\NewDocumentCommand \ceset { m } + { + \keys_set:nn { copyedit } { #1 } + \__cedt_lang_check:n { \l__cedt_lang_tl } + } +\cs_set_eq:NN \cesetup \ceset +\NewDocumentCommand \switchvariant { m m m m } + { + \int_case:nn { \l__cedt_lang_int } + { + { 0 } { #1 } + { 1 } { #2 } + { 2 } { #3 } + { 3 } { #4 } + } + } + +\NewDocumentCommand \definevariant { m m m m } + { + \tl_set:cn { g_vara_#1_tl } + { \switchvariant { #1 } { #2 } { #3 } { #4 } } + \tl_set:cn { g_vara_#2_tl } + { \switchvariant { #1 } { #2 } { #3 } { #4 } } + \tl_set:cn { g_vara_#3_tl } + { \switchvariant { #1 } { #2 } { #3 } { #4 } } + \tl_set:cn { g_vara_#4_tl } + { \switchvariant { #1 } { #2 } { #3 } { #4 } } + } + +\DeclareDocumentCommand \vara { s m } + { + \IfBooleanTF {#1} + { #2 } + { \normalvara {#2} } + } + +\NewDocumentCommand \normalvara { m } + { + \use:c { g_vara_#1_tl } + } +\NewDocumentCommand \hyp { m m } { #1-#2 } +\NewDocumentCommand \closeup { m m } { #1#2 } +\NewDocumentCommand \sword { m m } { #1~#2 } +\NewDocumentCommand \definelat { m m m } + { + \tl_set:cn { g__cedt_lat_#1_tl } + { + \group_begin: + \int_case:nn { \l__cedt_abbr_int} + { + { 0 } { \itshape } + { 1 } { \upshape } + } + \int_case:nn { \l__cedt_lat_int } + { + { 0 } { #1 } + { 1 } { #2 } + { 2 } { #3 } + } + \group_end: + } + } + +\NewDocumentCommand \lat { m } { \use:c { g__cedt_lat_#1_tl } } +\NewDocumentCommand \pc { m } + { + \int_case:nn { \l__cedt_pc_int } + { + { 0 } { \unskip,~#1,~ } + { 1 } { (#1) } + { 2 } { ---~#1~--- } + { 3 } { \unskip\footnote{#1} } + { 4 } { \marginpar{ \footnotesize\raggedright#1} } + } + } +\clist_new:N \l__cedt_clist +\NewDocumentCommand \elist { m } + { + \clist_set:Nn \l__cedt_clist { #1 } + \clist_use:Nnnn \l__cedt_clist { ~and~ } { ,~ } { ~and~ } + } +\NewDocumentCommand \definetoken { m m m m } + { + \tl_gset:cn { #1num } { 0 } + \tl_gset:cn { g_toks_#1_0_tl } { #2 \tl_gset:cn { #1num } { 1 } } + \tl_gset:cn { g_toks_#1_1_tl } { #3 \tl_gset:cn { #1num } { 2 } } + \tl_gset:cn { g_toks_#1_2_tl } { #4 \tl_gset:cn { #1num } { 2 } } + } +\NewDocumentCommand \tkn { m } + { \use:c { g_toks_#1_\use:c{#1num}_tl } } +\cs_set_eq:NN \Token \tkn +\RequirePackage{enumitem} +\chardef\thre@=3 +\newenvironment{enumerate*}[1][]% + {\@nameuse{enit@enumerate*}\enitdp@enumerate{enum}\thre@{#1}} + {\@nameuse{enit@endenumerate*}} +\int_new:N \l__cedt_elistcnt_int +\NewDocumentCommand \lastlabel { } { \tex_xdef:D\@itemlabel{Lastly}} +\NewDocumentCommand \mysep { } { ;\hskip .5em plus .1em minus .1em } +\NewDocumentCommand \myseplast { } {\space and \space } +\NewDocumentCommand \elistcnt { } { \int_use:N \l__cedt_elistcnt_int } +\NewDocumentCommand \LastItem { m m } + { \tl_gset:cn { l__cedt_tmpa_#1_tl } { #2 } } +\NewDocumentCommand \checklast { m } + { + \tl_if_exist:cTF { l__cedt_tmpa_ \elistcnt _tl } + { \int_set:Nn \l_tmpa_int { \use:c{ l__cedt_tmpa_\elistcnt _tl }} } + { \int_set:Nn \l_tmpa_int { 0 } } + \int_set:Nn \l_tmpb_int { \the\c@enumi } + \int_compare:nNnTF { \l_tmpa_int } = { \l_tmpb_int } + { + \bool_if:NTF \l__cedt_last_bool + { + \int_case:nn { \l__cedt_eitem_int } + { + { 0 } { Lastly, } + { 1 } { Last, } + { 4 } { lastly, } + { 5 } { last, } + } + } + { #1 } + } + { #1 } + } +\makeatletter +\def\ctext#1{\expandafter\@ctext\csname c@#1\endcsname} +\def\@ctext#1{\ifcase#1\or \checklast{First,}\or + \checklast{Second,}\or \checklast{Third,}\or + \checklast{Fourth,}\or \checklast{Fifth,}\or + \checklast{Sixth,}\or \checklast{Seventh,}\or + \checklast{Eigth,}\or \checklast{Nineth,}\or + \checklast{Tenth,}\fi} +\AddEnumerateCounter{\ctext}{\@ctext}{Second,} + +\def\ltext#1{\expandafter\@ltext\csname c@#1\endcsname} +\def\@ltext#1{\ifcase#1\or \checklast{Firstly,}\or + \checklast{Secondly,}\or \checklast{Thirdly,}\or + \checklast{Fourthly,}\or \checklast{Fifthly,}\or + \checklast{Sixthly,}\or \checklast{Seventhly,}\or + \checklast{Eigthly,}\or \checklast{Ninethly,}\or + \checklast{Tenthly,}\fi} +\AddEnumerateCounter{\ltext}{\@ltext}{Secondly,} + +\def\paractext#1{\expandafter\@paractext\csname c@#1\endcsname} +\def\@paractext#1{\ifcase#1\or \checklast{First,}\or + \checklast{second,}\or \checklast{third,}\or + \checklast{fourth,}\or \checklast{fifth,}\or + \checklast{sixth,}\or \checklast{seventh,}\or + \checklast{eigth,}\or \checklast{nineth,}\or + \checklast{tenth,}\fi} +\AddEnumerateCounter{\paractext}{\@paractext}{second,} + +\def\paraltext#1{\expandafter\@paraltext\csname c@#1\endcsname} +\def\@paraltext#1{\ifcase#1\or \checklast{Firstly,}\or + \checklast{secondly,}\or \checklast{thirdly,}\or + \checklast{fourthly,}\or \checklast{fifthly,}\or + \checklast{sixthly,}\or \checklast{seventhly,}\or + \checklast{eigthly,}\or \checklast{ninethly,}\or + \checklast{tenthly,}\fi} +\AddEnumerateCounter{\paraltext}{\@paraltext}{secondly,} +\NewDocumentEnvironment { eitem } { } + { + \int_gincr:N \l__cedt_elistcnt_int + \int_case:nn { \l__cedt_eitem_int } + { + { 0 } { \begin{enumerate} + [label=\ltext*,align=left,itemjoin=\mysep,itemjoin*=\myseplast] } + { 1 } { \begin{enumerate} + [label=\ctext*,align=left,itemjoin=\mysep,itemjoin*=\myseplast] } + { 2 } { \begin{enumerate}[label=\arabic*.] } + { 3 } { \begin{enumerate}[label=\textbullet] } + { 4 } { \begin{enumerate*} + [label=\paraltext*,itemjoin=\mysep,itemjoin*=\myseplast] } + { 5 } { \begin{enumerate*} + [label=\paractext*,itemjoin=\mysep,itemjoin*=\myseplast] } + } + } + { + \wrAux { \token_to_str:N \LastItem + { \int_use:N \l__cedt_elistcnt_int } {\the\c@enumi} } + \int_case:nn { \l__cedt_eitem_int } + { + { 0 } { \end{enumerate} } + { 1 } { \end{enumerate} } + { 2 } { \end{enumerate} } + { 3 } { \end{enumerate} } + { 4 } { \end{enumerate*} } + { 5 } { \end{enumerate*} } + } + } +%% + +%% +%% +%% End of file `copyedit.sty'. |