diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-01 21:17:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-01 21:17:56 +0000 |
commit | 6347b5ea0f28c36e21a7d4371605934e6ab252fa (patch) | |
tree | 9dfa5b2924d1c982cf5d5cc09ccbdac32b7b8a0d /Master | |
parent | f3e77606f13c3ff3c0915bd4860c3486948400c6 (diff) |
embrac (1oct19)
git-svn-id: svn://tug.org/texlive/trunk@52244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.pdf | bin | 462479 -> 456745 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.tex | 42 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/embrac/embrac.sty | 181 |
5 files changed, 156 insertions, 79 deletions
diff --git a/Master/texmf-dist/doc/latex/embrac/README b/Master/texmf-dist/doc/latex/embrac/README index 477c644cbe8..e07d2f2340a 100644 --- a/Master/texmf-dist/doc/latex/embrac/README +++ b/Master/texmf-dist/doc/latex/embrac/README @@ -3,13 +3,13 @@ the EMBRAC package Upright Brackets in Emphasized Text -2017/07/04 v0.7 +2019/10/01 v0.8 -------------------------------------------------------------------------- Clemens Niederberger Web: https://bitbucket.org/cgnieder/embrac/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2012--2017 Clemens Niederberger +Copyright 2012--2019 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf b/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf Binary files differindex 457f76889fc..41adfcec3be 100644 --- a/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf +++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_en.tex b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex index ec1bfb379e5..635475e4439 100644 --- a/Master/texmf-dist/doc/latex/embrac/embrac_en.tex +++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex @@ -12,7 +12,7 @@ % Web: https://bitbucket.org/cgnieder/embrac/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012--2017 Clemens Niederberger +% Copyright 2012--2019 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -40,6 +40,7 @@ AddEmph, ChangeEmph, DeleteEmph, + emb,embbracket,embparen, EmbracOff, EmbracOn, printbibliography, @@ -97,17 +98,6 @@ I like to thank both Dominik Waßenhoven for inspiration~\cite{dtk12-dw} and Bruno Le Floch for providing code~\cite{lefloch11}. Without either of them this package probably wouldn't exist. -\section{New} -\begin{description} - \item[v0.1a] The command \cs{RenewEmph} has been renamed into - \cs{ChangeEmph} and a new slightly different \cs{RenewEmph} has been added. - \item[v0.2] Improved interaction with \pkg{biblatex}. - \item[v0.3] Added support for \pkg*{fontspec}'s \cs{textsi}. - \item[v0.5] Don't replace brackets in math mode. - \item[v0.6] Added support for \cs{textsl}. - \item[v0.7] Added support for symbols with a catcode other than~12. -\end{description} - \section{About}\label{sec:about} \begin{cnltxquote}[{\cite[85]{bringhurst04}}] Parentheses and brackets are not letters, and it makes little sense to speak @@ -127,7 +117,6 @@ package probably wouldn't exist. from my [sic] bed}.\kern.05em} \end{cnltxquote} -\noindent Both this quote from~\citetitle{bringhurst04} by Robert Bringhurst and the article \citetitle{dtk12-dw} by Dominik Waßenhoven~\cite{dtk12-dw} inspired this package. Indeed, \embrac\ heavily borrows from the code @@ -341,5 +330,32 @@ Please be aware that \embrac\ does not affect \cs{itshape} nor \cs{em} (nor \begin{example} \itshape This is italic [sic] text. \end{example} +In cases like this one of the following commands could be used: +\begin{commands} + \command{emb}[\marg{op}\marg{cl}\marg{text}] + Encloses\sinceversion{v0.8} \meta{text} with \meta{op} and \meta{cl}. Both + \meta{op} and \meta{cl} must be brackets known to \embrac. + \command{embparen}[\marg{text}] + Encloses\sinceversion{v0.8} \meta{text} with upright parentheses. This is + the same as \cs{emb}\Marg{(}\Marg{)}\marg{text}. + \command{embbracket}[\marg{text}] + Encloses\sinceversion{v0.8} \meta{text} with upright brackets. This is + the same as \cs{emb}\Marg{[}\Marg{]}\marg{text}. +\end{commands} +\begin{example} + \itshape This is italic \embbracket{sic} text. +\end{example} + +\section{Version History} +\begin{description} + \item[v0.1a] The command \cs{RenewEmph} has been renamed into + \cs{ChangeEmph} and a new slightly different \cs{RenewEmph} has been added. + \item[v0.2] Improved interaction with \pkg{biblatex}. + \item[v0.3] Added support for \pkg*{fontspec}'s \cs{textsi}. + \item[v0.5] Don't replace brackets in math mode. + \item[v0.6] Added support for \cs{textsl}. + \item[v0.7] Added support for symbols with a catcode other than~12. + \item[v0.8] Added \cs{embparen}, \cs{embbracket} and \cs{emb}. +\end{description} \end{document} diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex b/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex index ec1425c169d..dbd52af4778 100644 --- a/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex +++ b/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex @@ -1,4 +1,4 @@ -% arara: pdflatex +% arara: lualatex: { interaction: nonstopmode } % -------------------------------------------------------------------------- % the EMBRAC package % @@ -35,8 +35,8 @@ \usepackage{fontspec} % load desired font, for example: -% \usepackage{libertine} -\setmainfont{Minion Pro} +\usepackage{libertine} +% \setmainfont{Minion Pro} \usepackage{embrac} @@ -76,4 +76,4 @@ \emph{This is emphasized text (as you can see).} -\end{document}
\ No newline at end of file +\end{document} diff --git a/Master/texmf-dist/tex/latex/embrac/embrac.sty b/Master/texmf-dist/tex/latex/embrac/embrac.sty index 2a5d12675bd..279291a5537 100644 --- a/Master/texmf-dist/tex/latex/embrac/embrac.sty +++ b/Master/texmf-dist/tex/latex/embrac/embrac.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/embrac/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012--2017 Clemens Niederberger +% Copyright 2012--2019 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -34,14 +34,17 @@ \RequirePackage { expl3 , xparse , l3keys2e } \ProvidesExplPackage {embrac} - {2017/07/04} - {0.7} + {2019/10/01} + {0.8} {Upright Brackets in Emphasized Text} % -------------------------------------------------------------------------- \bool_new:N \l__embrac_treat_biblatex_bool -\tl_new:N \l__embrac_tmpa_tl -\tl_new:N \l__embrac_treat_biblatex_tl + +\tl_new:N \l__embrac_tmpa_tl +\tl_new:N \l__embrac_treat_biblatex_tl + +\int_new:N \l__embrac_penalty_int \keys_define:nn {embrac} { @@ -85,56 +88,102 @@ } } -\cs_new:Npn \embrac_nobreak: - { \tex_penalty:D \c_ten_thousand } +\cs_new_protected:Npn \embrac_nobreak: + { \embrac_allow_break:n {10000} } + +\cs_new_protected:Npn \embrac_allow_break:n #1 + { \tex_penalty:D #1 \scan_stop: } + +\cs_new_protected:Npn \embrac_save_penalty: + { \int_set:Nn \l__embrac_penalty_int { \lastpenalty } } % -------------------------------------------------------------------------- % THE MAIN PART: % storage of the tokens to be replaced: -\prop_new:N \l__embrac_emph_obrackets_symp_prop -\prop_new:N \l__embrac_emph_obrackets_prop -\prop_new:N \l__embrac_emph_obrackets_before_prop -\prop_new:N \l__embrac_emph_cbrackets_symp_prop -\prop_new:N \l__embrac_emph_cbrackets_prop -\prop_new:N \l__embrac_emph_cbrackets_after_prop - -\cs_new_protected:Npn \__embrac_replace:Nnnn #1#2#3#4 - { - \tl_replace_all:Nnn #1 {#3} +\prop_new:N \l__embrac_emph_obrackets_symbol_prop +\prop_new:N \l__embrac_emph_obrackets_inner_prop +\prop_new:N \l__embrac_emph_obrackets_outer_prop +\prop_new:N \l__embrac_emph_cbrackets_symbol_prop +\prop_new:N \l__embrac_emph_cbrackets_inner_prop +\prop_new:N \l__embrac_emph_cbrackets_outer_prop + +\bool_new:N \l__embrac_opening_bool + +% #1: tl macro +% #2: code before +% #3: kerning before +% #4: symbol +% #5: kerning after +% #6: code after +\cs_new_protected:Npn \__embrac_replace:Nnnnnn #1#2#3#4#5#6 + { + \tl_replace_all:Nnn #1 {#4} { \mode_if_math:TF - {#3} + {#4} { - \embrac_kern:n {#2} + #2 + \embrac_kern:n {#3} \embrac_nobreak: - \embrac_braces_format:n {#3} - \embrac_nobreak: - \embrac_kern:n {#4} + \embrac_braces_format:n {#4} \embrac_nobreak: + \embrac_kern:n {#5} + #6 } } } -\cs_generate_variant:Nn \__embrac_replace:Nnnn {Nxx,Nnxx} +\cs_generate_variant:Nn \__embrac_replace:Nnnnnn {Nnxx,Nnnxx} % do the replacing: +% #1: tl macro \cs_new_protected:Npn \embrac_replace_brackets:N #1 { - \prop_map_inline:Nn \l__embrac_emph_obrackets_prop + \prop_map_inline:Nn \l__embrac_emph_obrackets_inner_prop { - \__embrac_replace:Nxxn #1 - { \prop_item:Nn \l__embrac_emph_obrackets_before_prop {##1} } - { \prop_item:Nn \l__embrac_emph_obrackets_symp_prop {##1} } + \__embrac_replace:Nnxxnn #1 + { \embrac_allow_break:n { \lastpenalty } } + { \prop_item:Nn \l__embrac_emph_obrackets_outer_prop {##1} } + { \prop_item:Nn \l__embrac_emph_obrackets_symbol_prop {##1} } {##2} + { \embrac_nobreak: } } - \prop_map_inline:Nn \l__embrac_emph_cbrackets_prop + \prop_map_inline:Nn \l__embrac_emph_cbrackets_inner_prop { - \__embrac_replace:Nnxx #1 + \__embrac_replace:Nnnxxn #1 + { \embrac_save_penalty: \embrac_nobreak: } {##2} - { \prop_item:Nn \l__embrac_emph_cbrackets_symp_prop {##1} } - { \prop_item:Nn \l__embrac_emph_cbrackets_after_prop {##1} } + { \prop_item:Nn \l__embrac_emph_cbrackets_symbol_prop {##1} } + { \prop_item:Nn \l__embrac_emph_cbrackets_outer_prop {##1} } + { \embrac_allow_break:n { \l__embrac_penalty_int } } } } +\cs_new_protected:Npn \embrac_enparen:nnn #1#2#3 + { + \group_begin: + \embrac_allow_break:n { \lastpenalty } + \embrac_kern:n + { \prop_item:Nn \l__embrac_emph_obrackets_outer_prop {#1} } + \embrac_nobreak: + \embrac_braces_format:n + { \prop_item:Nn \l__embrac_emph_obrackets_symbol_prop {#1} } + \embrac_nobreak: + \embrac_kern:n + { \prop_item:Nn \l__embrac_emph_obrackets_inner_prop {#1} } + #3 + \embrac_save_penalty: \embrac_nobreak: + \embrac_kern:n + { \prop_item:Nn \l__embrac_emph_cbrackets_inner_prop {#2} } + \embrac_nobreak: + \embrac_braces_format:n + { \prop_item:Nn \l__embrac_emph_cbrackets_symbol_prop {#2} } + \embrac_nobreak: + \embrac_kern:n + { \prop_item:Nn \l__embrac_emph_cbrackets_outer_prop {#2} } + \embrac_allow_break:n { \l__embrac_penalty_int } + \group_end: + } + % -------------------------------------------------------------------------- % biblatex compatibility: \cs_new_protected:Npn \embrac_treat_bibparens: @@ -165,6 +214,7 @@ % redefine \emph and friends: \seq_new:N \l__embrac_changed_macros_seq +% #1: name of macro to be treated \cs_new_protected:Npn \embrac_new_replacement_macro:n #1 { \seq_put_right:Nn \l__embrac_changed_macros_seq {#1} @@ -230,24 +280,24 @@ % internal add commands: \cs_new_protected:Npn \embrac_add_op_to_emph:nnn #1#2#3 { - \prop_put:Nnn \l__embrac_emph_obrackets_symp_prop {#1} {#1} + \prop_put:Nnn \l__embrac_emph_obrackets_symbol_prop {#1} {#1} \embrac_empty_or_no_value:nTF {#2} - { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_prop {#1} {0pt} } - { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_prop {#1} {#2} } + { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_inner_prop {#1} {0pt} } + { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nTF {#3} - { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_before_prop {#1} {0pt} } - { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_before_prop {#1} {#3} } + { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_outer_prop {#1} {0pt} } + { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_outer_prop {#1} {#3} } } \cs_new_protected:Npn \embrac_add_cl_to_emph:nnn #1#2#3 { - \prop_put:Nnn \l__embrac_emph_cbrackets_symp_prop {#1} {#1} + \prop_put:Nnn \l__embrac_emph_cbrackets_symbol_prop {#1} {#1} \embrac_empty_or_no_value:nTF {#2} - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_prop {#1} {0pt} } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_prop {#1} {#2} } + { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_inner_prop {#1} {0pt} } + { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nTF {#3} - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_after_prop {#1} {0pt} } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_after_prop {#1} {#3} } + { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_outer_prop {#1} {0pt} } + { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_outer_prop {#1} {#3} } } \cs_new_protected:Npn \embrac_add_to_emph:nnnnnn #1#2#3#4#5#6 @@ -259,14 +309,14 @@ % internal delete commands: \cs_new_protected:Npn \embrac_remove_op_from_emph:n #1 { - \prop_remove:Nn \l__embrac_emph_obrackets_prop {#1} - \prop_remove:Nn \l__embrac_emph_obrackets_before_prop {#1} + \prop_remove:Nn \l__embrac_emph_obrackets_inner_prop {#1} + \prop_remove:Nn \l__embrac_emph_obrackets_outer_prop {#1} } \cs_new_protected:Npn \embrac_remove_cl_from_emph:n #1 { - \prop_remove:Nn \l__embrac_emph_cbrackets_prop {#1} - \prop_remove:Nn \l__embrac_emph_cbrackets_after_prop {#1} + \prop_remove:Nn \l__embrac_emph_cbrackets_inner_prop {#1} + \prop_remove:Nn \l__embrac_emph_cbrackets_outer_prop {#1} } \cs_new_protected:Npn \embrac_remove_from_emph:nn #1#2 @@ -279,21 +329,21 @@ \cs_new_protected:Npn \embrac_renew_op_emph:nnn #1#2#3 { \embrac_empty_or_no_value:nTF {#2} - { \prop_put:Nnn \l__embrac_emph_obrackets_prop {#1} {0pt} } - { \prop_put:Nnn \l__embrac_emph_obrackets_prop {#1} {#2} } + { \prop_put:Nnn \l__embrac_emph_obrackets_inner_prop {#1} {0pt} } + { \prop_put:Nnn \l__embrac_emph_obrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nTF {#3} - { \prop_put:Nnn \l__embrac_emph_obrackets_before_prop {#1} {0pt} } - { \prop_put:Nnn \l__embrac_emph_obrackets_before_prop {#1} {#3} } + { \prop_put:Nnn \l__embrac_emph_obrackets_outer_prop {#1} {0pt} } + { \prop_put:Nnn \l__embrac_emph_obrackets_outer_prop {#1} {#3} } } \cs_new_protected:Npn \embrac_renew_cl_emph:nnn #1#2#3 { \embrac_empty_or_no_value:nTF {#2} - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop {#1} {0pt} } - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop {#1} {#2} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_inner_prop {#1} {0pt} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nTF {#3} - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop {#1} {0pt} } - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop {#1} {#3} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_outer_prop {#1} {0pt} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_outer_prop {#1} {#3} } } \cs_new_protected:Npn \embrac_renew_emph:nnnnnn #1#2#3#4#5#6 @@ -305,23 +355,23 @@ % internal change commands: \cs_new_protected:Npn \embrac_change_op_emph:nnn #1#2#3 { - \prop_if_in:NnT \l__embrac_emph_obrackets_prop {#1} + \prop_if_in:NnT \l__embrac_emph_obrackets_inner_prop {#1} { \embrac_empty_or_no_value:nF {#2} - { \prop_put:Nnn \l__embrac_emph_obrackets_prop {#1} {#2} } + { \prop_put:Nnn \l__embrac_emph_obrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nF {#3} - { \prop_put:Nnn \l__embrac_emph_obrackets_before_prop {#1} {#3} } + { \prop_put:Nnn \l__embrac_emph_obrackets_outer_prop {#1} {#3} } } } \cs_new_protected:Npn \embrac_change_cl_emph:nnn #1#2#3 { - \prop_if_in:NnT \l__embrac_emph_cbrackets_prop {#1} + \prop_if_in:NnT \l__embrac_emph_cbrackets_inner_prop {#1} { \embrac_empty_or_no_value:nF {#2} - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop {#1} {#2} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_inner_prop {#1} {#2} } \embrac_empty_or_no_value:nF {#3} - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop {#1} {#3} } + { \prop_put:Nnn \l__embrac_emph_cbrackets_outer_prop {#1} {#3} } } } @@ -423,6 +473,15 @@ \ignorespaces } +\NewDocumentCommand \embparen {+m} + { \embrac_enparen:nnn {(} {)} {#1} } + +\NewDocumentCommand \embbracket {+m} + { \embrac_enparen:nnn {[} {]} {#1} } + +\NewDocumentCommand \emb {mm+m} + { \embrac_enparen:nnn {#1} {#2} {#3} } + % -------------------------------------------------------------------------- % add some defaults and finalize package: \AddEmph{[}{]}[.04em,-.12em] @@ -432,7 +491,7 @@ \AtBeginDocument { \embrac_treat_bibemph: } -\tex_endinput:D +\file_input_stop: % -------------------------------------------------------------------------- % HISTORY @@ -457,3 +516,5 @@ 2016/01/07 - v0.6d - \prop_get:Nn => \prop_item:Nn 2017/07/04 - v0.7 - implement issue #8 (now treatment of symbols with catcode other than 12 is possible) +2019/10/01 - v0.8 - fix issue #9 + - new macros \embparen, \embbracket and \emb |