texlive[53334] Master/texmf-dist: embrac
commits+karl at tug.org
commits+karl at tug.org
Mon Jan 6 00:48:52 CET 2020
Revision: 53334
http://tug.org/svn/texlive?view=revision&revision=53334
Author: karl
Date: 2020-01-06 00:48:51 +0100 (Mon, 06 Jan 2020)
Log Message:
-----------
embrac
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/tex/latex/embrac/embrac.sty
Modified: trunk/Master/texmf-dist/doc/latex/embrac/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/embrac/README 2020-01-05 23:48:36 UTC (rev 53333)
+++ trunk/Master/texmf-dist/doc/latex/embrac/README 2020-01-05 23:48:51 UTC (rev 53334)
@@ -3,7 +3,7 @@
Upright Brackets in Emphasized Text
-2019/10/01 v0.8
+2019/12/31 v0.9
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://bitbucket.org/cgnieder/embrac/
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 2020-01-05 23:48:36 UTC (rev 53333)
+++ trunk/Master/texmf-dist/doc/latex/embrac/embrac_en.tex 2020-01-05 23:48:51 UTC (rev 53334)
@@ -1,7 +1,7 @@
-% arara: pdflatex
-% !arara: biber
-% !arara: pdflatex
-% arara: pdflatex
+% arara: pdflatex: { interaction: nonstopmode }
+% arara: biber
+% arara: pdflatex: { interaction: nonstopmode }
+% arara: pdflatex: { interaction: nonstopmode }
% --------------------------------------------------------------------------
% the EMBRAC package
%
@@ -41,6 +41,7 @@
ChangeEmph,
DeleteEmph,
emb,embbracket,embparen,
+ EmbracMakeKnown,
EmbracOff,
EmbracOn,
printbibliography,
@@ -292,6 +293,22 @@
\code{embrac\_kerning\_test.tex} for testing kerning values. You should find
it in the same directory as this documentation.
+\section{Adding More Commands}
+If\sinceversion{0.9} you like to add additional macros to \embrac's treatment
+(in addition to the already known \cs*{emph}, \cs*{textit}, \cs*{textsl}, and
+\cs*{textsi}) then you can use the following command
+\begin{commands}
+ \command{EmbracMakeKnown}[\marg{command}]
+ Redefine the command \meta{command} to replace brackets and parentheses by
+ upright ones. \meta{command} is the name of the command \emph{without} the
+ leading backslash!
+\end{commands}
+\embrac\ does this:
+\begin{sourcecode}
+ \EmbracMakeKnown{emph}
+ \EmbracMakeKnown{textit}
+ \EmbracMakeKnown{textsl}
+\end{sourcecode}
\section{biblatex Compatibility}
This is \embrac's only package option:
@@ -333,13 +350,13 @@
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
+ Encloses\sinceversion{0.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
+ Encloses\sinceversion{0.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
+ Encloses\sinceversion{0.8} \meta{text} with upright brackets. This is
the same as \cs{emb}\Marg{[}\Marg{]}\marg{text}.
\end{commands}
\begin{example}
@@ -356,6 +373,7 @@
\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}.
+ \item[v0.9] Added \cs{EmbracMakeKnown}
\end{description}
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty 2020-01-05 23:48:36 UTC (rev 53333)
+++ trunk/Master/texmf-dist/tex/latex/embrac/embrac.sty 2020-01-05 23:48:51 UTC (rev 53334)
@@ -34,8 +34,8 @@
\RequirePackage { expl3 , xparse , l3keys2e }
\ProvidesExplPackage
{embrac}
- {2019/10/01}
- {0.8}
+ {2019/12/31}
+ {0.9}
{Upright Brackets in Emphasized Text}
% --------------------------------------------------------------------------
@@ -89,14 +89,11 @@
}
\cs_new_protected:Npn \embrac_nobreak:
- { \embrac_allow_break:n {10000} }
+ { \tex_penalty:D 10000 \scan_stop: }
-\cs_new_protected:Npn \embrac_allow_break:n #1
- { \tex_penalty:D #1 \scan_stop: }
+\cs_new_protected:Npn \embrac_allow_break:
+ { \tex_penalty:D 0 \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:
@@ -110,29 +107,28 @@
\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
+% #2: kerning before
+% #3: symbol
+% #4: kerning after
+% #5: code after
+\cs_new_protected:Npn \__embrac_replace:Nnnnn #1#2#3#4#5
{
- \tl_replace_all:Nnn #1 {#4}
+ \tl_replace_all:Nnn #1 {#3}
{
\mode_if_math:TF
{#4}
{
- #2
- \embrac_kern:n {#3}
\embrac_nobreak:
- \embrac_braces_format:n {#4}
+ \embrac_kern:n {#2}
\embrac_nobreak:
- \embrac_kern:n {#5}
- #6
+ \embrac_braces_format:n {#3}
+ \embrac_nobreak:
+ \embrac_kern:n {#4}
+ #5
}
}
}
-\cs_generate_variant:Nn \__embrac_replace:Nnnnnn {Nnxx,Nnnxx}
+\cs_generate_variant:Nn \__embrac_replace:Nnnnn {Nxx,Nnxx}
% do the replacing:
% #1: tl macro
@@ -140,8 +136,7 @@
{
\prop_map_inline:Nn \l__embrac_emph_obrackets_inner_prop
{
- \__embrac_replace:Nnxxnn #1
- { \embrac_allow_break:n { \lastpenalty } }
+ \__embrac_replace:Nxxnn #1
{ \prop_item:Nn \l__embrac_emph_obrackets_outer_prop {##1} }
{ \prop_item:Nn \l__embrac_emph_obrackets_symbol_prop {##1} }
{##2}
@@ -149,39 +144,42 @@
}
\prop_map_inline:Nn \l__embrac_emph_cbrackets_inner_prop
{
- \__embrac_replace:Nnnxxn #1
- { \embrac_save_penalty: \embrac_nobreak: }
+ \__embrac_replace:Nnxxn #1
{##2}
{ \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 } }
+ {
+ \peek_charcode:NTF \c_space_tl
+ { \embrac_allow_break: }
+ { \embrac_nobreak: }
+ }
}
}
\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:
+ \embrac_nobreak:
+ \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_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} }
+ \peek_charcode:NTF \c_space_tl
+ { \embrac_allow_break: }
+ { \embrac_nobreak: }
}
% --------------------------------------------------------------------------
@@ -243,11 +241,14 @@
}
}
-\embrac_new_replacement_macro:n {emph}
-\embrac_new_replacement_macro:n {textit}
-\embrac_new_replacement_macro:n {textsl}
+\NewDocumentCommand \EmbracMakeKnown {m}
+ { \embrac_new_replacement_macro:n {#1} }
+
+\EmbracMakeKnown {emph}
+\EmbracMakeKnown {textit}
+\EmbracMakeKnown {textsl}
\AtBeginDocument
- { \embrac_if_fontspec:T { \embrac_new_replacement_macro:n {textsi} } }
+ { \embrac_if_fontspec:T { \EmbracMakeKnown {textsi} } }
% --------------------------------------------------------------------------
% TURNING EMBRAC OFF AND ON:
@@ -518,3 +519,5 @@
other than 12 is possible)
2019/10/01 - v0.8 - fix issue #9
- new macros \embparen, \embbracket and \emb
+2019/12/31 - v0.9 - new: \EmbracMakeKnown
+ - change penalties
More information about the tex-live-commits
mailing list