diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-13 23:44:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-13 23:44:35 +0000 |
commit | a43dfb3aaf9458a242743878b8ddb3ef995f956d (patch) | |
tree | 0877f008c14114d0d7ba5bb05d3ccf31c27db58c | |
parent | c0dc062c01f14cacf38aee55437d0b97571c280a (diff) |
embrac (13may13)
git-svn-id: svn://tug.org/texlive/trunk@30450 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.pdf | bin | 446076 -> 447570 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.tex | 172 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/embrac/embrac.sty | 237 |
4 files changed, 292 insertions, 119 deletions
diff --git a/Master/texmf-dist/doc/latex/embrac/README b/Master/texmf-dist/doc/latex/embrac/README index 6cfed841ef2..f1868b0761b 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 -2013/04/04 v0.3a +2013/05/13 v0.4 -------------------------------------------------------------------------- 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 Binary files differindex cc00fe951ef..0d4fa63cb19 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 d23b8dd10f7..707ca4d4977 100644 --- a/Master/texmf-dist/doc/latex/embrac/embrac_en.tex +++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex @@ -1,6 +1,6 @@ % arara: pdflatex -% arara: biber -% arara: pdflatex +% !arara: biber +% !arara: pdflatex % arara: pdflatex % -------------------------------------------------------------------------- % the EMBRAC package @@ -53,7 +53,7 @@ } \usepackage{libertinehologopatch} -\usepackage{fnpct} +\usepackage{fnpct,ragged2e} \cnpkgusecolorscheme{friendly} \renewcommand*\othersectionlevelsformat[3]{% \textcolor{main}{#3\autodot}\enskip} @@ -129,6 +129,22 @@ \RenewEmph{[}[-0.045em,.02em]{]}[.055em,-.09em] \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] +\usepackage{marginnote} +\makeatletter +\providecommand*\sinceversion[1]{% + \@bsphack + \marginnote{% + \footnotesize\sffamily\RaggedRight + \textcolor{black!75}{Introduced in version~#1}}% + \@esphack} +\providecommand*\changedversion[1]{% + \@bsphack + \marginnote{% + \footnotesize\sffamily\RaggedRight + \textcolor{black!75}{Changed in version~#1}}% + \@esphack} +\makeatother + \begin{document} \section{License and Requirements}\secidx{License}\secidx{Requirements} @@ -156,31 +172,33 @@ package probably wouldn't exist. \section{About}\label{sec:about}\secidx{About} \begin{zitat}[{{\cite[85]{bringhurst04}}}] - Parentheses and brackets are not letters, and it makes little sense to speak of - them as roman or italic. There are vertical parentheses and sloped ones, and - the parentheses on italic fonts are almost always sloped, but vertical parentheses - are generally to be preferred. That means they must come from the roman font, - and may need extra spacing when used with italic letterforms. + Parentheses and brackets are not letters, and it makes little sense to speak + of them as roman or italic. There are vertical parentheses and sloped ones, + and the parentheses on italic fonts are almost always sloped, but vertical + parentheses are generally to be preferred. That means they must come from + the roman font, and may need extra spacing when used with italic + letterforms. - The sloped square brackets usually found on italic fonts are, if anything, even - less useful than sloped parentheses. If, perish the thought, there were a book - or film entitled \emph*{The View from My [sic] Bed}, sloped brackets might be - useful as a way of indicating that the brackets and their contents are actually - part of the title. Otherwise, vertical brackets should be used, no matter whether - the text is roman or italic: \textquote{The View from My \emph{[sic]} Bed} and - \textquote{\emph{the view from my [sic] bed}.\kern.05em} + The sloped square brackets usually found on italic fonts are, if anything, + even less useful than sloped parentheses. If, perish the thought, there + were a book or film entitled \emph*{The View from My [sic] Bed}, sloped + brackets might be useful as a way of indicating that the brackets and their + contents are actually part of the title. Otherwise, vertical brackets + should be used, no matter whether the text is roman or italic: + \textquote{The View from My \emph{[sic]} Bed} and \textquote{\emph{the view + from my [sic] bed}.\kern.05em} \end{zitat} \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 \citeauthor{dtk12-dw} -provided in his article\manythanks. The code was originally provided by Bruno -Le~Floch\manythanks\ answering a question on +this package. Indeed, \embrac heavily borrows from the code +\citeauthor{dtk12-dw} provided in his article\manythanks. The code was +originally provided by Bruno Le~Floch\manythanks\ answering a question on \href{http://tex.stackexchange.com}{TeX.sx}~\cite{lefloch11}. \embrac tries to redefine \cmd{emph} and \cmd{textit} in a way that neither -parentheses nor square brackets are sloped. In an ideal world you of course +parentheses nor square brackets are sloped. In an ideal world you of course wouldn't need this package because the italic font you're using would have vertical parentheses and brackets by itself. @@ -207,45 +225,59 @@ Let's see the example again: \emph{This is emphasized [sic] text.} \\ \emph{This is emphasized text (as you can see).} \end{beispiel} -As you can see you don't have to do anything apart from loading \embrac in your -preamble. Well -- that's actually not entirely true. You have to take care of the -kerning of the parentheses and brackets. Otherwise things could look worse with -\embrac than without. +As you can see you don't have to do anything apart from loading \embrac in +your preamble. Well -- that's actually not entirely true. You have to take +care of the kerning of the parentheses and brackets. Otherwise things could +look worse with \embrac than without. The following example demonstrates one point why you have to be very careful -when using \embrac. Certain parenthesis-letter combinations might need adjustments -of the kerning: +when using \embrac. Certain parenthesis-letter combinations might need +adjustments of the kerning: \begin{beispiel} \emph{This is (just) emphasized text.} \\ \emph{This is (\kern.1em just) emphasized text.} \end{beispiel} -This of course strongly depends on the font you've chosen. Kerning is a very -important aspect when using this package and you shouldn't use it without giving -it a certain amount of attention. See the next section for more details. -\secidx*{How it Works} +This of course strongly depends on the font you've chosen. Kerning is a very +important aspect when using this package and you shouldn't use it without +giving it a certain amount of attention. See the next section for more +details. \secidx*{How it Works} \section{Adding More Brackets \&\ Adjusting the Kerning} -\secidx{Adding More Brackets}\secidx{Adjusting the Kerning} -If you want you can change the behaviour of \embrac. Maybe it should only affect -squared brackets? Or curly braces, too? This can be done with the following -commands. They all work locally which means if used inside a group outside of it -everything stays what it was. +\secidx{Adding More Brackets}\secidx{Adjusting the Kerning} If you want you +can change the behaviour of \embrac. Maybe it should only affect squared +brackets? Or curly braces, too? This can be done with the following +commands. They all work locally which means if used inside a group outside of +it everything stays what it was. \begin{beschreibung} \Befehl{AddEmph}{<o>}\oa{<io-kern>,<oo-kern>}\ma{<c>}\oa{<ic-kern>,<oc-kern>} \Befehl{ChangeEmph}{<o>}\oa{<io-kern>,<oo-kern>}\ma{<c>}\oa{<ic-kern>,<oc-kern>} \Befehl{RenewEmph}{<o>}\oa{<io-kern>,<oo-kern>}\ma{<c>}\oa{<ic-kern>,<oc-kern>} \Befehl{DeleteEmph}{<o>}\ma{<c>} \end{beschreibung} -Here \code{<o>} means \emph{opening bracket} and \code{<c>} means \emph{closing -bracket}. The kerning arguments are all four optional and require -- if given -- -to be a length. If they're not given \cmd{AddEmph} and \cmd{RenewEmph} insert -\code{0pt} and \cmd{ChangeEmph} uses the value stored by \cmd{AddEmph} or -\cmd{RenewEmph} before. +Here \code{<o>} means \emph{opening bracket} and \code{<c>} means +\emph{closing bracket}. The kerning arguments are all four optional and +require -- if given -- to be a length. If they're not given \cmd{AddEmph} and +\cmd{RenewEmph} insert \code{0pt} and \cmd{ChangeEmph} uses the value stored +by \cmd{AddEmph} or \cmd{RenewEmph} before. + +\sinceversion{0.4}To each of these commands there are two variants that are +only semantically different\footnote{They're also using different lists + internally but you shouldn't concern yourself with this.}. They are all +called \cmd*{<base>OpEmph} or \cmd*{<base>ClEmph} where \code{<base>} is +either \code{Add}, \code{Change}, \code{Renew} or \code{Delete}. Their +arguments are all the same: the half of what the main commands have for either +modifying the opening or the closing symbols. +\begin{beschreibung} + \Befehl{AddOpEmph}{<o>}\oa{<io-kern>,<oo-kern>} + \Befehl{AddClEmph}{<c>}\oa{<ic-kern>,<oc-kern>} +\end{beschreibung} +They allow you to add single symbols to \embrac's mechanism instead of adding +pairs. -\code{<io-kern>} is inserted after the opening bracket (inner opening), -\code{<oo-kern>} is inserted before it (outer opening). \code{<ic-kern>} is -inserted before the closing bracket (inner closing), \code{<oc-kern>} after it -(outer closing). +In all these commands the optional argument \code{<io-kern>} is inserted after +the opening bracket (inner opening), \code{<oo-kern>} is inserted before it +(outer opening). \code{<ic-kern>} is inserted before the closing bracket +(inner closing), \code{<oc-kern>} after it (outer closing). \embrac initially makes these definitions: \begin{beispiel}[code only] @@ -254,25 +286,26 @@ inserted before the closing bracket (inner closing), \code{<oc-kern>} after it \AddEmph{(}[-.04em]{)}[,-.15em] \end{beispiel} -This document however uses ``Linux Libertine O''\footnote{\url{http://www.linuxlibertine.org/}} -both for the roman and the italic font and redefines them in this way (still not -sure these are the best values): +This document however uses ``Linux Libertine +O''\footnote{\url{http://www.linuxlibertine.org/}} both for the roman and the +italic font and redefines them in this way (still not sure these are the best +values): \begin{beispiel}[code only] \RenewEmph{[}[-0.045em,.02em]{]}[.055em,-.09em] \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] \end{beispiel} -You can change them as you wish, but be careful with the kerning! What's too less -for one letter might be too much for others: +You can change them as you wish, but be careful with the kerning! What's too +less for one letter might be too much for others: \begin{beispiel} \ChangeEmph{(}[.1em]{)}[.1em] \emph{This is (just) emphasized text.} \\ % looks ok \emph{This is emphasized text (as you can see).} % looks bad \end{beispiel} -To see why it is important to pay attention to the kerning values let's look at -how \embrac's features look without kerning (\ie, \code{0pt} for each value), -with the default settings and with the settings for this document: +To see why it is important to pay attention to the kerning values let's look +at how \embrac's features look without kerning (\ie, \code{0pt} for each +value), with the default settings and with the settings for this document: \begin{center} \begin{minipage}{.5\linewidth} @@ -305,31 +338,31 @@ with the default settings and with the settings for this document: \end{minipage} \end{center} -Deleting a pair removes it completely from \embrac's mechanism. All information -about the pair and its kerning values will be lost. So if you want the effects -to be temporary use grouping. +Deleting a pair removes it completely from \embrac's mechanism. All +information about the pair and its kerning values will be lost. So if you +want the effects to be temporary use grouping. \begin{beispiel} \DeleteEmph{[}{]} \emph{This is emphasized [sic] text.} \\ \emph{This is emphasized text (as you can see).} \end{beispiel} -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. -\secidx*{Adding More Brackets}\secidx*{Adjusting the Kerning} +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. \secidx*{Adding More + Brackets}\secidx*{Adjusting the Kerning} \section{biblatex Compatibility}\secidx{biblatex Compatibility} This is \embrac's only package option: \begin{beschreibung} - \Option{biblatex}{\default{true}|on|parens|false|off|none}\Default{false} - If set to \code{true} (or one of its aliases) parentheses and squared brackets - as defined by \paket{biblatex} with \cmd{bibleftparen}, \cmd{bibrightparen}, - \cmd{bibleftbracket} and \cmd{bibrightbracket} are treated the same way (if - not removed from the treatment with \cmd{DeleteEmph}). + \Option{biblatex}{\default{true}|on|parens|false|off|none}\Default{false} If + set to \code{true} (or one of its aliases) parentheses and squared brackets + as defined by \paket{biblatex} with \cmd{bibleftparen}, \cmd{bibrightparen}, + \cmd{bibleftbracket} and \cmd{bibrightbracket} are treated the same way (if + not removed from the treatment with \cmd{DeleteEmph}). - The command \cmd{blx@imc@mkbibemph} is patched to use the original definition - of \cmd{emph}. + The command \cmd{blx@imc@mkbibemph} is patched to use the original definition + of \cmd{emph}. \end{beschreibung} \begin{beispiel} @@ -339,9 +372,10 @@ This is \embrac's only package option: \secidx*{biblatex Compatibility} \section{Turn \embrac Temporarily Off}\secidx{Turn \embrac Temporarily Off} -Redefining \cmd{emph} and \cmd{textit} is not without danger. Sometimes you might -find that you'd want to keep the original definition for a small portion of your -document. You can use the following commands whose functions are obvious, I guess: +Redefining \cmd{emph} and \cmd{textit} is not without danger. Sometimes you +might find that you'd want to keep the original definition for a small portion +of your document. You can use the following commands whose functions are +obvious, I guess: \begin{beschreibung} \Befehl{EmbracOff} \Befehl{EmbracOn} @@ -362,4 +396,4 @@ Please be aware that \embrac does not affect \cmd{itshape} nor \cmd{em} (nor \indexprologue{\noindent Section titles are indicated \textbf{bold}, packages \textsf{sans serif}, commands \cmd*{brown} and options \key*{yellow}.} \printindex -\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 908fa356018..44b18b90da9 100644 --- a/Master/texmf-dist/tex/latex/embrac/embrac.sty +++ b/Master/texmf-dist/tex/latex/embrac/embrac.sty @@ -34,10 +34,25 @@ \RequirePackage { expl3 , xparse , l3keys2e } \ProvidesExplPackage {embrac} - {2013/04/04} - {0.3a} + {2013/05/13} + {0.4} {Upright Brackets in Emphasized Text} +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { embrac } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~embrac~will~abort! + } + \tex_endinput:D + } + +% -------------------------------------------------------------------------- \bool_new:N \l__embrac_treat_biblatex_bool \tl_new:N \l__embrac_tmpa_tl \tl_new:N \l__embrac_treat_biblatex_tl @@ -177,22 +192,22 @@ } % internal \emph command, second layer: -\cs_new_protected:Npn \__embrac_new_emph:w #1#2 +\cs_new_protected:Npn \__embrac_new_emph:nn #1#2 { \group_begin: \__embrac_treat_bibparens: - \IfBooleanTF { #1 } + \tl_if_eq:nnTF { #1 } { * } { \__embrac_orig_emph:n { #2 } } { \__embrac_emph:n { #2 } } \group_end: } % internal \textit command, second layer: -\cs_new_protected:Npn \__embrac_new_textit:w #1#2 +\cs_new_protected:Npn \__embrac_new_textit:nn #1#2 { \group_begin: \__embrac_treat_bibparens: - \IfBooleanTF { #1 } + \tl_if_eq:nnTF { #1 } { * } { \__embrac_orig_textit:n { #2 } } { \__embrac_textit:n { #2 } } \group_end: @@ -202,11 +217,11 @@ \AtBeginDocument{ \__embrac_if_fontspec:T { - \cs_new_protected:Npn \__embrac_new_textsi:w #1#2 + \cs_new_protected:Npn \__embrac_new_textsi:nn #1#2 { \group_begin: \__embrac_treat_bibparens: - \IfBooleanTF { #1 } + \tl_if_eq:nnTF { #1 } { * } { \__embrac_orig_textsi:n { #2 } } { \__embrac_textsi:n { #2 } } \group_end: @@ -216,18 +231,30 @@ % user command \emph: \RenewDocumentCommand \emph { sm } - { \__embrac_new_emph:w #1 { #2 } } + { + \IfBooleanTF { #1 } + { \__embrac_new_emph:nn { * } { #2 } } + { \__embrac_new_emph:nn { } { #2 } } + } % user command \textit: \RenewDocumentCommand \textit { sm } - { \__embrac_new_textit:w #1 { #2 } } + { + \IfBooleanTF { #1 } + { \__embrac_new_textit:nn { * } { #2 } } + { \__embrac_new_textit:nn { } { #2 } } + } % user command \textsi: \AtBeginDocument{ \__embrac_if_fontspec:T { \RenewDocumentCommand \textsi { sm } - { \__embrac_new_textsi:w #1 { #2 } } + { + \IfBooleanTF { #1 } + { \__embrac_new_textsi:nn { * } { #2 } } + { \__embrac_new_textsi:nn { } { #2 } } + } } } @@ -240,7 +267,7 @@ { \__embrac_orig_emph:n { ##2 } } \RenewDocumentCommand \textit { sm } { \__embrac_orig_textit:n { ##2 } } - \cs_if_exist:NT + \cs_if_exist:NT \textsi { \RenewDocumentCommand \textsi { sm } { \__embrac_orig_textsi:n { ##2 } } @@ -251,20 +278,32 @@ \NewDocumentCommand \EmbracOn {} { \RenewDocumentCommand \emph { sm } - { \__embrac_new_emph:w ##1 { ##2 } } + { + \IfBooleanTF { ##1 } + { \__embrac_new_emph:nn { * } { ##2 } } + { \__embrac_new_emph:nn { } { ##2 } } + } \RenewDocumentCommand \textit { sm } - { \__embrac_new_textit:w ##1 { ##2 } } - \cs_if_exist:NT + { + \IfBooleanTF { ##1 } + { \__embrac_new_textit:nn { * } { ##2 } } + { \__embrac_new_textit:nn { } { ##2 } } + } + \cs_if_exist:NT \textsi { \RenewDocumentCommand \textsi { sm } - { \__embrac_new_textsi:w ##1 { ##2 } } + { + \IfBooleanTF { ##1 } + { \__embrac_new_textsi:nn { * } { ##2 } } + { \__embrac_new_textsi:nn { } { ##2 } } + } } } % -------------------------------------------------------------------------- % ADDING AND REMOVING BRACKETS: -% internal add command: -\cs_new_protected:Npn \__embrac_add_to_emph:nnnnnn #1#2#3#4#5#6 +% internal add commands: +\cs_new_protected:Npn \embrac_add_op_to_emph:nnn #1#2#3 { \__embrac_empty_or_no_value:nTF { #2 } { \prop_put_if_new:Nnn \l__embrac_emph_obrackets_prop { #1 } { 0pt } } @@ -272,25 +311,45 @@ \__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 } } - \__embrac_empty_or_no_value:nTF { #5 } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_prop { #4 } { 0pt } } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_prop { #4 } { #5 } } - \__embrac_empty_or_no_value:nTF { #6 } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_after_prop { #4 } { 0pt } } - { \prop_put_if_new:Nnn \l__embrac_emph_cbrackets_after_prop { #4 } { #6 } } } -% internal delete command: -\cs_new_protected:Npn \__embrac_remove_from_emph:nn #1#2 +\cs_new_protected:Npn \embrac_add_cl_to_emph:nnn #1#2#3 + { + \__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 } } + \__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 } } + } + +\cs_new_protected:Npn \embrac_add_to_emph:nnnnnn #1#2#3#4#5#6 + { + \embrac_add_op_to_emph:nnn { #1 } { #2 } { #3 } + \embrac_add_cl_to_emph:nnn { #4 } { #5 } { #6 } + } + +% 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_cbrackets_prop { #2 } - \prop_remove:Nn \l__embrac_emph_cbrackets_after_prop { #2 } } -% internal renew command: -\cs_new_protected:Npn \__embrac_renew_emph:nnnnnn #1#2#3#4#5#6 +\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 } + } + +\cs_new_protected:Npn \embrac_remove_from_emph:nn #1#2 + { + \embrac_remove_op_from_emph:n { #1 } + \embrac_remove_cl_from_emph:n { #2 } + } + +% internal renew commands: +\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 } } @@ -298,16 +357,26 @@ \__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 } } - \__embrac_empty_or_no_value:nTF { #5 } - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop { #4 } { 0pt } } - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop { #4 } { #5 } } - \__embrac_empty_or_no_value:nTF { #6 } - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop { #4 } { 0pt } } - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop { #4 } { #6 } } } -% internal change command: -\cs_new_protected:Npn \__embrac_change_emph:nnnnnn #1#2#3#4#5#6 +\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 } } + \__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 } } + } + +\cs_new_protected:Npn \embrac_renew_emph:nnnnnn #1#2#3#4#5#6 + { + \embrac_renew_op_emph:nnn { #1 } { #2 } { #3 } + \embrac_renew_cl_emph:nnn { #4 } { #5 } { #6 } + } + +% 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 } { @@ -316,15 +385,26 @@ \__embrac_empty_or_no_value:nF { #3 } { \prop_put:Nnn \l__embrac_emph_obrackets_before_prop { #1 } { #3 } } } - \prop_if_in:NnT \l__embrac_emph_cbrackets_prop { #4 } + } + +\cs_new_protected:Npn \embrac_change_cl_emph:nnn #1#2#3 + { + \prop_if_in:NnT \l__embrac_emph_cbrackets_prop { #1 } { - \__embrac_empty_or_no_value:nF { #5 } - { \prop_put:Nnn \l__embrac_emph_cbrackets_prop { #4 } { #5 } } - \__embrac_empty_or_no_value:nF { #6 } - { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop { #4 } { #6 } } + \__embrac_empty_or_no_value:nF { #2 } + { \prop_put:Nnn \l__embrac_emph_cbrackets_prop { #1 } { #2 } } + \__embrac_empty_or_no_value:nF { #3 } + { \prop_put:Nnn \l__embrac_emph_cbrackets_after_prop { #1 } { #3 } } } } +\cs_new_protected:Npn \embrac_change_emph:nnnnnn #1#2#3#4#5#6 + { + \embrac_change_op_emph:nnn { #1 } { #2 } { #3 } + \embrac_change_cl_emph:nnn { #4 } { #5 } { #6 } + } + +% -------------------------------------------------------------------------- % user commands: \NewDocumentCommand \AddEmph { @@ -332,13 +412,39 @@ m > { \SplitArgument { 1 } { , } } O{,} } { - \__embrac_add_to_emph:nnnnnn { #1 } #2 { #3 } #4 + \embrac_add_to_emph:nnnnnn { #1 } #2 { #3 } #4 + \ignorespaces + } + +\NewDocumentCommand \AddOpEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_add_op_to_emph:nnn { #1 } #2 + \ignorespaces + } + +\NewDocumentCommand \AddClEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_add_cl_to_emph:nnn { #1 } #2 \ignorespaces } \NewDocumentCommand \DeleteEmph { mm } { - \__embrac_remove_from_emph:nn { #1 } { #2 } + \embrac_remove_from_emph:nn { #1 } { #2 } + \ignorespaces + } + +\NewDocumentCommand \DeleteOpEmph { mm } + { + \embrac_remove_op_from_emph:n { #1 } + \ignorespaces + } + +\NewDocumentCommand \DeleteClEmph { mm } + { + \embrac_remove_cl_from_emph:n { #1 } \ignorespaces } @@ -348,7 +454,21 @@ m > { \SplitArgument { 1 } { , } } O{,} } { - \__embrac_renew_emph:nnnnnn { #1 } #2 { #3 } #4 + \embrac_renew_emph:nnnnnn { #1 } #2 { #3 } #4 + \ignorespaces + } + +\NewDocumentCommand \RenewOpEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_renew_op_emph:nnn { #1 } #2 + \ignorespaces + } + +\NewDocumentCommand \RenewClEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_renew_cl_emph:nnn { #1 } #2 \ignorespaces } @@ -358,11 +478,26 @@ m > { \SplitArgument { 1 } { , } } O{,} } { - \__embrac_change_emph:nnnnnn { #1 } #2 { #3 } #4 + \embrac_change_emph:nnnnnn { #1 } #2 { #3 } #4 \ignorespaces } -% add some defaults: +\NewDocumentCommand \ChangeOpEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_change_op_emph:nnn { #1 } #2 + \ignorespaces + } + +\NewDocumentCommand \ChangeClEmph + { m > { \SplitArgument { 1 } { , } } O{,} } + { + \embrac_change_cl_emph:nnn { #1 } #2 + \ignorespaces + } + +% -------------------------------------------------------------------------- +% add some defaults and finalize package: \AddEmph{[}{]}[.04em,-.12em] \AddEmph{(}[-.04em]{)}[,-.15em] @@ -372,6 +507,7 @@ \tex_endinput:D +% -------------------------------------------------------------------------- % HISTORY 2012/06/29 - v0.1 - first public release 2012/06/29 - v0.1a - renamed \RenewEmph => \ChangeEmph and added new \RenewEmph @@ -380,4 +516,7 @@ - changed buggy definition of \EmbracOff and \EmbracOn 2013/03/22 - v0.3 - made definitions robust where appropriate - added support for `fontspec's \textsi -2013/04/04 - v0.3a - bug fix in \EmbracOn and \EmbracOff
\ No newline at end of file +2013/04/04 - v0.3a - bug fix in \EmbracOn and \EmbracOff +2013/05/13 - v0.4 - added versions of \AddEmph, \RenewEmph, \DeleteEmph and + \ChangeEmph that allow setting opening or closing parts + separately
\ No newline at end of file |