texlive[52244] Master/texmf-dist: embrac (1oct19)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 1 23:17:56 CEST 2019


Revision: 52244
          http://tug.org/svn/texlive?view=revision&revision=52244
Author:   karl
Date:     2019-10-01 23:17:56 +0200 (Tue, 01 Oct 2019)
Log Message:
-----------
embrac (1oct19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/embrac/README
    trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf
    trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.tex
    trunk/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex
    trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty

Modified: trunk/Master/texmf-dist/doc/latex/embrac/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/embrac/README	2019-10-01 21:17:27 UTC (rev 52243)
+++ trunk/Master/texmf-dist/doc/latex/embrac/README	2019-10-01 21:17:56 UTC (rev 52244)
@@ -3,13 +3,13 @@
 
   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 at 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

Modified: trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.tex	2019-10-01 21:17:27 UTC (rev 52243)
+++ trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.tex	2019-10-01 21:17:56 UTC (rev 52244)
@@ -12,7 +12,7 @@
 % Web:    https://bitbucket.org/cgnieder/embrac/
 % E-Mail: contact at 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 @@
 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 @@
       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 @@
 \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}

Modified: trunk/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex	2019-10-01 21:17:27 UTC (rev 52243)
+++ trunk/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex	2019-10-01 21:17:56 UTC (rev 52244)
@@ -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}

Modified: trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty	2019-10-01 21:17:27 UTC (rev 52243)
+++ trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty	2019-10-01 21:17:56 UTC (rev 52244)
@@ -8,7 +8,7 @@
 % Web:    https://bitbucket.org/cgnieder/embrac/
 % E-Mail: contact at 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,15 +34,18 @@
 \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}
   {
     biblatex         .choice: ,
@@ -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
+\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
 
-\cs_new_protected:Npn \__embrac_replace:Nnnn #1#2#3#4
+\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 {#3}
+    \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_braces_format:n {#4}
             \embrac_nobreak:
-            \embrac_kern: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



More information about the tex-live-commits mailing list