summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-05 23:48:51 +0000
committerKarl Berry <karl@freefriends.org>2020-01-05 23:48:51 +0000
commit46b4be03e0a86a0f4eeca053d9a5ce7350749e3d (patch)
tree37ccee9704f869177d1673402466200bccec370f
parentb8b82d8520dcef89f00ec840eb0bb213b04762ce (diff)
embrac
git-svn-id: svn://tug.org/texlive/trunk@53334 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/embrac/README2
-rw-r--r--Master/texmf-dist/doc/latex/embrac/embrac_en.pdfbin456745 -> 458551 bytes
-rw-r--r--Master/texmf-dist/doc/latex/embrac/embrac_en.tex32
-rw-r--r--Master/texmf-dist/tex/latex/embrac/embrac.sty109
4 files changed, 82 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/latex/embrac/README b/Master/texmf-dist/doc/latex/embrac/README
index e07d2f2340a..43d046d330d 100644
--- a/Master/texmf-dist/doc/latex/embrac/README
+++ b/Master/texmf-dist/doc/latex/embrac/README
@@ -3,7 +3,7 @@ the EMBRAC package
Upright Brackets in Emphasized Text
-2019/10/01 v0.8
+2019/12/31 v0.9
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://bitbucket.org/cgnieder/embrac/
diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf b/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf
index 41adfcec3be..99e0a7ecd7f 100644
--- a/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf
+++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_en.tex b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex
index 635475e4439..b1265849a8e 100644
--- a/Master/texmf-dist/doc/latex/embrac/embrac_en.tex
+++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex
@@ -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 @@ By the way: this packages provides a simple file
\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 @@ Please be aware that \embrac\ does not affect \cs{itshape} nor \cs{em} (nor
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 @@ In cases like this one of the following commands could be used:
\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}
diff --git a/Master/texmf-dist/tex/latex/embrac/embrac.sty b/Master/texmf-dist/tex/latex/embrac/embrac.sty
index 279291a5537..55786b982af 100644
--- a/Master/texmf-dist/tex/latex/embrac/embrac.sty
+++ b/Master/texmf-dist/tex/latex/embrac/embrac.sty
@@ -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,13 +89,10 @@
}
\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_save_penalty:
- { \int_set:Nn \l__embrac_penalty_int { \lastpenalty } }
+\cs_new_protected:Npn \embrac_allow_break:
+ { \tex_penalty:D 0 \scan_stop: }
% --------------------------------------------------------------------------
% THE MAIN PART:
@@ -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
- {
- \tl_replace_all:Nnn #1 {#4}
+% #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 {#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_braces_format:n {#3}
\embrac_nobreak:
- \embrac_kern:n {#5}
- #6
+ \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