diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-13 17:56:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-13 17:56:30 +0000 |
commit | 75d256635dbdbe6b18ab0a72f3e4015120d6b2fb (patch) | |
tree | 83d7e4e0f3b2b69c5584947a76675e9e58b5d104 /Master | |
parent | bab607b4b126505720438036b6390c01dec3d691 (diff) |
new latex package embrac (8jul12)
git-svn-id: svn://tug.org/texlive/trunk@27027 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/README | 37 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.pdf | bin | 0 -> 855814 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_en.tex | 375 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex | 76 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/embrac/embrac.sty | 284 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/embrac.tlpsrc | 0 |
8 files changed, 774 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/embrac/README b/Master/texmf-dist/doc/latex/embrac/README new file mode 100644 index 00000000000..4d009a3239e --- /dev/null +++ b/Master/texmf-dist/doc/latex/embrac/README @@ -0,0 +1,37 @@ +-------------------------------------------------------------------------- +the EMBRAC package + + Upright Brackets in Emphasized Text + +2012/06/29 v0.1a +-------------------------------------------------------------------------- +Clemens Niederberger +Web: https://bitbucket.org/cgnieder/embrac/ +E-Mail: contact@mychemistry.eu +-------------------------------------------------------------------------- +Copyright 2012 Clemens Niederberger + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Clemens Niederberger. +-------------------------------------------------------------------------- +The embrac package consists of the files + - embrac.sty, embrac_en.tex, embrac_en.pdf, embrac_kerning_test.tex and + README +-------------------------------------------------------------------------- +If you have any ideas, questions, suggestions or bugs to report, please +feel free to contact me. +-------------------------------------------------------------------------- +> this package is strongly based on an article by Dominik Waßenhoven in +> “Die TeXnische Komödie” 2 (2012), pp. 51--53 +> which introduces code by Bruno Le Floch. Code parts and idea used with +> their kind permission. Many thanks! +--------------------------------------------------------------------------
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf b/Master/texmf-dist/doc/latex/embrac/embrac_en.pdf Binary files differnew file mode 100644 index 00000000000..346c10d64bc --- /dev/null +++ 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 new file mode 100644 index 00000000000..608fa510a7a --- /dev/null +++ b/Master/texmf-dist/doc/latex/embrac/embrac_en.tex @@ -0,0 +1,375 @@ +% arara: pdflatex +% arara: makeindex: { sort: true, style: embrac_en.ist } +% arara: biber +% arara: pdflatex +% arara: pdflatex +% -------------------------------------------------------------------------- +% the EMBRAC package +% +% Upright Brackets in Emphasized Text +% +% 2012/06/29 +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/embrac/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2012 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% The embrac package consists of the files +% - embrac.sty, embrac_en.tex, embrac_en.pdf, embrac_kerning_test.tex and +% README +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% +% if you want to compile this documentation you'll need the document class +% `cnpkgdoc' which you can get here: +% https://bitbucket.org/cgnieder/cnpkgdoc/ +% the class is licensed LPPL 1.3 or later +% +\documentclass[DIV10,toc=index,toc=bib]{cnpkgdoc} +\docsetup{ + pkg = [biblatex]embrac, + code-box = { + backgroundcolor = gray!7!white , + skipbelow = .6\baselineskip plus .5ex minus .5ex , + skipabove = .6\baselineskip plus .5ex minus .5ex , + roundcorner = 3pt , + } , + gobble = 1 +} +\usepackage[osf]{libertine} +\usepackage{fnpct} +\cnpkgcolors{ + main => cnpkgred , + key => yellow!40!brown , + module => cnpkgblue , + link => black!90 +} + +\renewcommand*\othersectionlevelsformat[3]{% + \textcolor{main}{#3\autodot}\enskip} +\renewcommand*\partformat{% + \textcolor{main}{\partname~\thepart\autodot}} + + +\ExplSyntaxOn +\NewDocumentCommand \Default {g} + { + \hfill\llap + { + \IfNoValueTF { #1 } + {(initially~empty)} + {Default:~\code{#1}} + } + \newline + } +\ExplSyntaxOff + +\addcmds{ + AddEmph, + DeleteEmph, + EmbracOff, + EmbracOn, + printbibliography, + ChangeEmph +} + +\usepackage[backend=biber,style=alphabetic]{biblatex} +\addbibresource{\jobname.bib} +\usepackage{filecontents} +\begin{filecontents}{\jobname.bib} +@book{bringhurst04, + title = {The Elements of Typographic Style}, + author = {Robert Bringhurst}, + year = {2004}, + version = {3.2}, + isbn = {978-0-88179-205-5}, + publisher = {Hartley \&\ Marks, Canada} +} +@article{dtk12-dw, + author = {Dominik Waßenhoven}, + title = {Aufrechte Klammern in kursivem Text}, + journal = {Die \TeX{}nische Komödie}, + volume = {2}, + year = {2012}, + pages = {51--53} +} +@online{lefloch11, + author = {Bruno Le Floch}, + title = {Upright parentheses in italic text}, + url = {http://tex.stackexchange.com/a/13057/5049}, + date = {2011-03-09}, + urldate = {2012-06-28} +} +\end{filecontents} + +% index: +\usepackage{makeidx} +\begin{filecontents}{\jobname.ist} + heading_prefix "{\\bfseries " + heading_suffix "\\hfil}\\nopagebreak\n" + headings_flag 1 + delim_0 "\\dotfill " + delim_1 "\\dotfill " + delim_2 "\\dotfill " + delim_r "\\textendash" + suffix_2p "\\nohyperpage{\\,f.}" + suffix_3p "\\nohyperpage{\\,ff.}" +\end{filecontents} +\makeindex + +\usepackage{fixfoot} +\DeclareFixedFootnote\manythanks{Many thanks again for his kind permission to use it!} + +\ChangeEmph{[}[,.02em]{]}[.055em,-.08em] +\ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] +\begin{document} + +\section{License and Requirements}\secidx{License}\secidx{Requirements} +\embrac is placed under the terms of the LaTeX Project Public License, +version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). +It has the status ``maintained.'' + +\embrac loads and needs the packages \paket{expl3}, \paket{xparse} and +\paket{l3keys2e}, the first is part of the \paket{l3kernel} and the others are +part of the \paket{l3packages}. +\secidx*{License}\secidx*{Requirements} + +\section{Acknowledgements} +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 \cmd{RenewEmph} has been renamed into + \cmd{ChangeEmph} and a new slightly different \cmd{RenewEmph} has been added. +\end{description} + +\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. + + 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\ as an answer to a question on \{TeX.SE\}~\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 +wouldn't need this package because the italic font you're using would have +vertical parentheses and brackets by itself. + +\begin{beispiel} + \emph{This is emphasized [sic] text.} \\ + \emph{This is emphasized text (as you can see).} +\end{beispiel} +\secidx*{About} + +\section{How it Works}\secidx{How it Works} +Both the commands \cmd{emph} and \cmd{textit} are redefined: +\begin{beschreibung} + \Befehl{emph}*{<emphasized text>} + \Befehl{textit}*{<text in italics>} +\end{beschreibung} +They now both have a \code{*} argument that restores the original behaviour. +Otherwise they're used just as before. + +Let's see the example again: +\begin{beispiel} + \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. + +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: +\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} + +\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. +\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. + +\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] + % add some defaults: + \AddEmph{[}{]}[.04em,-.12em] + \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): +\begin{beispiel}[code only] + \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] + \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: +\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: + +\begin{center} + \begin{minipage}{.5\linewidth} + \textbf{No Kerning:} + + \RenewEmph{[}{]}\RenewEmph{(}{)} + \emph{This is emphasized [sic] text.} \\ + \emph{This is emphasized text [as you can see].} \\ + \emph{This is emphasized (sic) text.} \\ + \emph{This is emphasized text (as you can see).} + \end{minipage}\bigskip + + \begin{minipage}{.5\linewidth} + \textbf{\embrac's Default Kerning:} + + \RenewEmph{[}{]}[.04em,-.12em]\RenewEmph{(}[-.04em]{)}[,-.15em] + \emph{This is emphasized [sic] text.} \\ + \emph{This is emphasized text [as you can see].} \\ + \emph{This is emphasized (sic) text.} \\ + \emph{This is emphasized text (as you can see).} + \end{minipage}\bigskip + + \begin{minipage}{.5\linewidth} + \textbf{Adjusted Kerning:} + + \emph{This is emphasized [sic] text.} \\ + \emph{This is emphasized text [as you can see].} \\ + \emph{This is emphasized (sic) text.} \\ + \emph{This is emphasized text (as you can see).} + \end{minipage} +\end{center} + +Deleting a pair removes it completely from \embrac's mechanism. All information +about the pair and it's 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} + +\section{biblatex Compatibility}\secidx{biblatex Compatibility} +This is \embrac's only package option: +\begin{beschreibung} + \Option{biblatex}{\default{true}|false}\Default{false} If set to true 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}). +\end{beschreibung} + +\begin{beispiel} + % this document uses \usepackage[biblatex]{embrac} + \emph{Let's cite the quote from section~\ref{sec:about} again:~\cite{bringhurst04}}. +\end{beispiel} +\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: +\begin{beschreibung} + \Befehl{EmbracOff} + \Befehl{EmbracOn} +\end{beschreibung} +Both commands are local. + +This document for example uses the following lines because \paket{biblatex} +complained when it tried to typeset the entry for~\cite{bringhurst04}. Using +\cmd{DeleteEmph}[] would have worked as well. +\begin{beispiel}[code only] + \EmbracOff + \printbibliography +\end{beispiel} +\secidx*{Turn \embrac Temporarily Off} + +\section{Watch out!}\secidx{Watch Out} +Please be aware that \embrac does not affect \cmd{itshape} nor the commands +\cmd{em} or \cmd{it} (which you shouldn't use in a \LaTeX\ document, anyway). +\begin{beispiel} + \itshape This is italic [sic] text. +\end{beispiel} +\secidx*{Watch Out} + +\EmbracOff +\printbibliography + + +\setindexpreamble{Section titles are indicated \textbf{bold}, packages +\textsf{sans serif}, commands \code{\textbackslash\textcolor{code}{brown}} + and options \textcolor{key}{\code{yellow}}.\par\bigskip} +\printindex +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex b/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex new file mode 100644 index 00000000000..93c1d4437cd --- /dev/null +++ b/Master/texmf-dist/doc/latex/embrac/embrac_kerning_test.tex @@ -0,0 +1,76 @@ +% arara: pdflatex +% -------------------------------------------------------------------------- +% the EMBRAC package +% +% Upright Brackets in Emphasized Text +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/embrac/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2012 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% The embrac package consists of the files +% - embrac.sty, embrac_en.tex, embrac_en.pdf, embrac_kerning_test.tex and +% README +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\documentclass{scrartcl} +\usepackage[T1]{fontenc} +\usepackage{embrac} + +% load desired font, for example: +% \usepackage{libertine} + +\begin{document} +% see the default: +\emph{This is emphasized [sic] text with [long] bla.} + +\emph{This is emphasized text [as you can see].} + +\emph{This is (sic) emphasized text with (long) bla.} + +\emph{This is emphasized text (as you can see).} + +\hrulefill + +% without additional kerning at all: +\RenewEmph{[}{]} +\RenewEmph{(}{)} +\emph{This is emphasized [sic] text with [long] bla.} + +\emph{This is emphasized text [as you can see].} + +\emph{This is (sic) emphasized text with (long) bla.} + +\emph{This is emphasized text (as you can see).} + +\hrulefill + +% your changes: +% \RenewEmph{[}[<io>,<oo>]{]}[<ic>,<oc>] +% \RenewEmph{(}[<io>,<oo>]{)}[<ic>,<oc>] +\emph{This is emphasized [sic] text with [long] bla.} + +\emph{This is emphasized text [as you can see].} + +\emph{This is (sic) emphasized text with (long) bla.} + +\emph{This is emphasized text (as you can see).} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/embrac/embrac.sty b/Master/texmf-dist/tex/latex/embrac/embrac.sty new file mode 100644 index 00000000000..a207abd7efc --- /dev/null +++ b/Master/texmf-dist/tex/latex/embrac/embrac.sty @@ -0,0 +1,284 @@ +% -------------------------------------------------------------------------- +% the EMBRAC package +% +% Upright Brackets in Emphasized Text +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/embrac/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2012 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% The embrac package consists of the files +% - embrac.sty, embrac_en.tex, embrac_en.pdf, embrac_kerning_test.tex and +% README +% -------------------------------------------------------------------------- +% > this package is strongly based on an article by Dominik Waßenhoven in +% > “Die TeXnische Komödie” 2 (2012), pp. 51--53 +% > which introduces code by Bruno Le Floch. Code parts and idea used with +% > their kind permission. Many thanks! +% -------------------------------------------------------------------------- +\RequirePackage { expl3 , xparse , l3keys2e } +\ProvidesExplPackage + {embrac} + {2012/06/29} + {0.1a} + {Upright Brackets in Emphasized Text} + +\bool_new:N \l_embrac_treat_biblatex_bool + +\keys_define:nn { embrac } + { biblatex .bool_set:N = \l_embrac_treat_biblatex_bool } + +% save original commands: +\cs_new_eq:Nc \embrac_orig_emph:n { emph~ } +\cs_generate_variant:Nn \embrac_orig_emph:n { V } + +\cs_new_eq:Nc \embrac_orig_textit:n { textit~ } +\cs_generate_variant:Nn \embrac_orig_textit:n { V } + +% preparations: +\cs_new_eq:NN \embrac_braces_format:n \textup +\cs_new_eq:NN \embrac_kern:n \skip_horizontal:n +\cs_new:Npn \embrac_empty_or_no_value:nTF #1#2#3 + { + \IfNoValueTF { #1 } { #2 } + { \tl_if_blank:nTF { #1 } { #2 } { #3 } } + } +\cs_new:Npn \embrac_empty_or_no_value:nF #1#2 + { + \IfNoValueF { #1 } + { \tl_if_blank:nF { #1 } { #2 } } + } + +% -------------------------------------------------------------------------- +% THE MAIN PART: +% storage of the tokens to be replaced: +\prop_new:N \l_embrac_emph_obrackets_prop +\prop_new:N \l_embrac_emph_obrackets_before_prop +\prop_new:N \l_embrac_emph_cbrackets_prop +\prop_new:N \l_embrac_emph_cbrackets_after_prop + +% do the replacing: +\cs_new:Npn \embrac_replace_brackets:N #1 + { + \prop_map_inline:Nn \l_embrac_emph_obrackets_prop + { + \tl_replace_all:Nnn #1 { ##1 } + { + \embrac_kern:n + { \prop_get:Nn \l_embrac_emph_obrackets_before_prop { ##1 } } + \embrac_braces_format:n { ##1 \embrac_kern:n { ##2 } } + } + } + \prop_map_inline:Nn \l_embrac_emph_cbrackets_prop + { + \tl_replace_all:Nnn #1 { ##1 } + { + \embrac_braces_format:n + { \embrac_kern:n { ##2 } ##1 } + \embrac_kern:n + { \prop_get:Nn \l_embrac_emph_cbrackets_after_prop { ##1 } } + } + } + } + +% internal \emph command: +\cs_new:Npn \embrac_emph:n #1 + { + \tl_set:Nn \l_tmpa_tl { #1 } + \embrac_replace_brackets:N \l_tmpa_tl + \embrac_orig_emph:V \l_tmpa_tl + } + +% internal \textit command: +\cs_new:Npn \embrac_textit:n #1 + { + \tl_set:Nn \l_tmpa_tl { #1 } + \embrac_replace_brackets:N \l_tmpa_tl + \embrac_orig_textit:V \l_tmpa_tl + } + +% biblatex compatibility: +\cs_new:Npn \embrac_treat_biblatex: + { + \bool_if:NT \l_embrac_treat_biblatex_bool + { + \embrac_replace_brackets:N \bibleftbracket + \embrac_replace_brackets:N \bibrightbracket + \embrac_replace_brackets:N \bibleftparen + \embrac_replace_brackets:N \bibrightparen + } + } + +% internal \emph command, second layer: +\cs_new_protected:Npn \embrac_new_emph:w #1#2 + { + \group_begin: + \embrac_treat_biblatex: + \IfBooleanTF { #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 + { + \group_begin: + \embrac_treat_biblatex: + \IfBooleanTF { #1 } + { \embrac_orig_textit:n { #2 } } + { \embrac_textit:n { #2 } } + \group_end: + } + +% user command \emph: +\RenewDocumentCommand \emph { sm } + { \embrac_new_emph:w #1 { #2 } } + +% user command \textit: +\RenewDocumentCommand \textit { sm } + { \embrac_new_emph:w #1 { #2 } } + +% -------------------------------------------------------------------------- +% TURNING EMBRAC OFF AND ON: +% turning embrac off: +\NewDocumentCommand \EmbracOff {} + { + \cs_set_eq:NN \emph \embrac_orig_emph:n + \cs_set_eq:NN \textit \embrac_orig_textit:n + } + +% turning embrac on: +\NewDocumentCommand \EmbracOn {} + { + \cs_set_eq:NN \emph \embrac_new_emph:w + \cs_set_eq:NN \textit \embrac_new_textit:w + } + +% -------------------------------------------------------------------------- +% ADDING AND REMOVING BRACKETS: +% internal add command: +\cs_new:Npn \embrac_add_to_emph:nnnnnn #1#2#3#4#5#6 + { + \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 } } + \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:Npn \embrac_remove_from_emph:nn #1#2 + { + \prop_del:Nn \l_embrac_emph_obrackets_prop { #1 } + \prop_del:Nn \l_embrac_emph_obrackets_before_prop { #1 } + \prop_del:Nn \l_embrac_emph_cbrackets_prop { #2 } + \prop_del:Nn \l_embrac_emph_cbrackets_after_prop { #2 } + } + +% internal renew command: +\cs_new:Npn \embrac_renew_emph:nnnnnn #1#2#3#4#5#6 + { + \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 } } + \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:Npn \embrac_change_emph:nnnnnn #1#2#3#4#5#6 + { + \prop_if_in:NnT \l_embrac_emph_obrackets_prop { #1 } + { + \embrac_empty_or_no_value:nF { #2 } + { \prop_put:Nnn \l_embrac_emph_obrackets_prop { #1 } { #2 } } + \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 } + { + \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 } } + } + } + +% user commands: +\NewDocumentCommand \AddEmph + { + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + } + { + \embrac_add_to_emph:nnnnnn { #1 } #2 { #3 } #4 + \ignorespaces + } + +\NewDocumentCommand \DeleteEmph { mm } + { + \embrac_remove_from_emph:nn { #1 } { #2 } + \ignorespaces + } + +\NewDocumentCommand \RenewEmph + { + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + } + { + \embrac_renew_emph:nnnnnn { #1 } #2 { #3 } #4 + \ignorespaces + } + +\NewDocumentCommand \ChangeEmph + { + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + m > { \SplitArgument { 1 } { , } } O{\NoValue,\NoValue} + } + { + \embrac_change_emph:nnnnnn { #1 } #2 { #3 } #4 + \ignorespaces + } + +% add some defaults: +\AddEmph{[}{]}[.04em,-.12em] +\AddEmph{(}[-.04em]{)}[,-.15em] + +\ProcessKeysOptions { embrac } + +\tex_endinput:D + +% HISTORY +2012/06/29 - v0.1 - first public release +2012/06/29 - v0.1a - renamed \RenewEmph => \ChangeEmph and added new \RenewEmph
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 7351abe9ab1..86bd9d85569 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -144,7 +144,7 @@ my @TLP_working = qw( egplot eiad eiad-ltx eijkhout einfuehrung ejpecp elbioimp electrum ellipsis elmath elpres elsarticle elteikthesis eltex elvish - emarks emptypage emulateapj emp encxvlna endfloat endheads endnotes + emarks embrac emptypage emulateapj emp encxvlna endfloat endheads endnotes engpron engrec engtlc enotez enumitem enumitem-zref envbig environ envlab epigrafica epigram epigraph epiolmec eplain epsdice epsf epsincl epslatex-fr epspdf epspdfconversion epstopdf diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index e2147ac6148..397007234ae 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -202,6 +202,7 @@ depend ellipsis depend elmath depend elpres depend emarks +depend embrac depend emptypage depend emulateapj depend endfloat diff --git a/Master/tlpkg/tlpsrc/embrac.tlpsrc b/Master/tlpkg/tlpsrc/embrac.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/embrac.tlpsrc |