diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/ncctools/extdash.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/ncctools/extdash.dtx | 155 |
1 files changed, 112 insertions, 43 deletions
diff --git a/Master/texmf-dist/source/latex/ncctools/extdash.dtx b/Master/texmf-dist/source/latex/ncctools/extdash.dtx index 52e192a811d..597ef17cd74 100644 --- a/Master/texmf-dist/source/latex/ncctools/extdash.dtx +++ b/Master/texmf-dist/source/latex/ncctools/extdash.dtx @@ -1,14 +1,15 @@ % \iffalse %% -%% File: extdash.dtx Copyright (C) 1998-2005 by Alexander I. Rozhenko +%% File: extdash.dtx Copyright (C) 1998-2018 by Alexander I. Rozhenko %% %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{extdash} -%<package> [2005/01/29 v1.2 Extended Dash Package (NCC)] +%<package> [2018/06/24 v1.3 Extended Dash Package (NCC)] % % \changes{v1.0}{1998/12/20}{Initial version} % \changes{v1.1}{2004/11/23}{Minor corrections of the documentation} % \changes{v1.2}{2005/01/29}{Change spaces surround em-dash} +% \changes{v1.3){2018/06/24}{Add more em-dash configuring options by request from Frank Mittelbach} % %<*driver> \let\makeindex\relax @@ -38,7 +39,7 @@ % \DescribeMacro{\Hyphdash} % \DescribeMacro{\Hyphdash*} % The main purpose of the |extdash| package is to allow hyphenation -% of compound words. When the word |something-something| occur the only +% of compound words. When the word |something-something| occurs, the only % hyphenation point after the dash is available. To allow hyphenation % of both words joint by dash you can write % \begin{center} @@ -46,19 +47,19 @@ % |something\-/something| % \end{center} % (the last case is available if\/ you use the package |extdash| -% with |shortcuts| option). Some times the line break immediately after -% the dash is inadmissible. To avoid it you can write +% with |shortcuts| option). Sometimes the line break immediately after +% the dash is inadmissible. To avoid this, you can write % \begin{center} % |something\Hyphdash* something|\quad or easier\quad % |something\=/something| % \end{center} -% (the last case is also shortcut). An example is the word -% \emph{$L$-approximation} which can't be broken at the dash. +% (the last case is also a shortcut). An example is the word +% \emph{$L$-approximation} which can't be broken at the dash.\pagebreak % % \DescribeMacro{\Endash} % \DescribeMacro{\Endash*} -% Analogously, you can use |\Endash| command (may be with star) to join -% words by \emph{en-dash}. Shortcuts for it are |\--| and |\==|. +% Analogously, you can use |\Endash| command (and its star version) to join +% words with \emph{en-dash}. Shortcuts for it are |\--| and |\==|. % % \DescribeMacro{\Emdash} % \DescribeMacro{\Emdash*} @@ -69,8 +70,8 @@ % \DescribeMacro{\Halfspace*} % half of the ordinary interword space. The |\Halfspace| command % produces the \emph{elastic} horizontal space and its |*|-form -% produces the unbreakable elastic space. All these commands have -% shortcuts, named +% produces the nonbreakable elastic space. All these commands have +% shortcuts % \begin{center} % |\---|\qquad |\===|\qquad |\-,|\qquad |\=,| % \end{center} @@ -78,29 +79,30 @@ % When |\Emdash| appears at the beginning of a paragraph (the direct % speech) the space after it will be rigid and unbreakable. % -% The standard em-dash is longer that it is required by Russian -% typesetting rules. To decrease its length to required one you have -% to use |extdash| package with |cyremdash| option. +% The standard em-dash is longer that it is required by Russian and German +% typesetting rules. To decrease its length to the required one, you can +% use this package with |shortemdash| option +% (the |cyremdash| option is also supported for compatibility with the previous +% version). % -% \section{The Package Options} +% Note: Some more options are available from the version 1.3. They control +% the spacing around |\Emdash| and the breaking strategy to be applied +% before it. +% +% \section{Package Options} +% +% \subsection{Shortcuts} % -% The |extdash| package provides two options, |shortcuts| and -% |cyremdash|: % \begin{center} -% |\usepackage[shortcuts,cyremdash]{extdash}| +% |\usepackage[shortcuts]{extdash}| % \end{center} % -% First option redefines \LaTeX{} commands |\-| and |\=| in +% The |shortcuts| option redefines \LaTeX{} commands |\-| and |\=| in % such a way to recognize shortcut sequences. If\/ no shortcut -% recognized the corresponding original command will be called. -% In other words, when no shortcut recognized the command |\-| +% recognized, the corresponding original command will be called. +% In other words, when no shortcut recognized, the command |\-| % sets extra hyphenation point and |\=| means the accent command. % -% The last option redefines |\Emdash| to be shorter than the standard -% em-dash. -% -% \section{The Shortcuts Table} -% % \begin{center} % \begin{tabular}{l@{\qquad}l@{\qquad\qquad}l@{\qquad}l} % Command & Shortcut & Command & Shortcut \\ @@ -113,9 +115,47 @@ % % \emph{All described commands and shortcuts are robust.} % +% \subsection{Breaks before em-dash} +% +% All dash commands defined in this package disallow line breaks before a dash. +% For em-dash this rule can be changed. To allow breaks before a em-dash, please +% use the option +% +% \begin{center} +% |\usepackage[allowbreakbefore]{extdash}| +% \end{center} +% +% \subsection{Shorter em-dash} +% +% \begin{center} +% |\usepackage[shortemdash]{extdash}| +% \end{center} +% +% This option redefines |\Emdash| to be shorter than the standard +% em-dash (0.8~em). +% +% \subsection{Spaces around em-dash} +% +% By default, the half-space is inserted before and after em-dash. +% This behavior can be changed with option +% +% \begin{center} +% |\usepackage[wordspacearound]{extdash}| +% \end{center} +% +% \noindent or +% +% \begin{center} +% |\usepackage[nospacearound]{extdash}| +% \end{center} +% +% The first option provides interword spaces around em-dash and the +% last one removes spaces around em-dash. Of course, these two +% options are mutually exclusive. +% % \StopEventually{} % -% \section{The Basic Implementation Part} +% \section{The Implementation} % % \begin{macro}{\EXD@test} % \begin{macro}{\EXD@break} @@ -142,7 +182,7 @@ \DeclareRobustCommand{\Endash}{\EXD@test{\EXD@dash{--}}} \DeclareRobustCommand{\Emdash}{\EXD@test{\EXD@emd@sh}} \DeclareRobustCommand{\Halfspace}{\@tempcnta\z@ - \@ifstar{\nobreak\EXD@space\ignorespaces}{\EXD@space\ignorespaces}% + \@ifstar{\EXD@nobreak\EXD@space\ignorespaces}{\EXD@space\ignorespaces}% } % \end{macrocode} % \end{macro} @@ -151,20 +191,28 @@ % \end{macro} % \begin{macro}{\EXD@dash} % \begin{macro}{\EXD@emd@sh} +% \begin{macro}{\EXD@nobreak} +% \begin{macro}{\EXD@embreakbefore} +% \begin{macro}{\EXD@spacecalc} % \begin{macro}{\EXD@space} % and then the basic commands % \begin{macrocode} +\def\EXD@nobreak{\ifvmode\leavevmode\else\nobreak\fi} \def\EXD@dash#1{% - \nobreak\leavevmode\hbox{#1}\EXD@break\hskip\z@skip \ignorespaces + \EXD@nobreak\hbox{#1}\EXD@break\hskip\z@skip \ignorespaces } +\def\EXD@emnobreak{\nobreak} \def\EXD@emd@sh{% \ifvmode - \EXD@emdash\nobreak\hskip.35em + \leavevmode\EXD@emdash\nobreak\hskip.35em \else - \unskip\nobreak\@tempcnta\m@ne + \unskip\EXD@emnobreak \@tempcnta\m@ne \EXD@space \EXD@emdash \EXD@break \EXD@space \fi \ignorespaces } +\DeclareOption{allowbreakbefore}{% + \let\EXD@emnobreak\@empty +} % \end{macrocode} % The |\@tempcnta| specifies the width of half-space. It can have % the following values: |-1|, |0|, or |+1|. The negative value @@ -173,39 +221,59 @@ % means a half-space after em-dash (the space is wider at this point). % This trick compensates a visual effect of wider space before an em-dash % especially if the punctuation mark goes before. +% +% The meaning of negative and positive values of |\@tempcnta| +% is redefined with |wordspacearound| and |nospacearound| options. % \begin{macrocode} -\def\EXD@space{% +\def\EXD@spacecalc{% \edef\@tempa{% \ifnum\@tempcnta<\z@ .4\else \ifnum \@tempcnta=\z@ .5\else .6\fi\fi }% - \hskip \@tempa\fontdimen2\font \@plus .5\fontdimen3\font + \def\@tempb{.5}% +} +\def\EXD@space{% + \EXD@spacecalc + \hskip \@tempa\fontdimen2\font \@plus \@tempb\fontdimen3\font \@minus \@tempa\fontdimen4\font \@tempcnta -\@tempcnta } +\DeclareOption{wordspacearound}{% + \def\EXD@spacecalc{% + \edef\@tempa{\ifnum \@tempcnta=\z@ .5\fi}% + \let\@tempb\@tempa + } +} +\DeclareOption{nospacearound}{% + \def\EXD@spacecalc{% + \edef\@tempa{\ifnum \@tempcnta=\z@ .5\else0\fi}% + \let\@tempb\@tempa + } +} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\EXD@emdash} % The last basic command is the default \emph{em-dash}. It could be -% redefined later in |cyremdash| option. +% redefined later in |shortemdash| option. % \begin{macrocode} -\def\EXD@emdash{\leavevmode\hbox{---}} +\def\EXD@emdash{\hbox{---}} % \end{macrocode} % \end{macro} % -% \section{Shortcuts} -% % \begin{macrocode} \DeclareOption{shortcuts}{% % \end{macrocode} % % \begin{macro}{\HyphOrDash} % \begin{macro}{\BarOrDash} -% The commands |\HyphOrDash| and |\BarOrDash| will be called by |\-| and -% |\=| commands. They choose the corresponding shortcut or the original -% commands saved in |\EXD@hyph| and |\EXD@dash|. +% The commands |\HyphOrDash| and |\BarOrDash| are called by |\-| and |\=| commands +% and can appear in aux file. They choose the corresponding shortcut or the original +% command saved in |\EXD@hyph| and |\EXD@bar|. % \begin{macrocode} \DeclareRobustCommand{\HyphOrDash}{% \let\EXD@break\@empty @@ -247,11 +315,12 @@ } % \end{macrocode} % -% \section{Cyrillic Em-dash} -% % \begin{macrocode} +\DeclareOption{shortemdash}{% + \def\EXD@emdash{\hb@xt@.8\fontdimen6\font{--\hss--}} +} \DeclareOption{cyremdash}{% - \def\EXD@emdash{\leavevmode\hb@xt@.8\fontdimen6\font{--\hss--}} + \def\EXD@emdash{\hb@xt@.8\fontdimen6\font{--\hss--}} } \ProcessOptions\relax %</package> |