GithubHelp home page GithubHelp logo

Comments (4)

davidcarlisle avatar davidcarlisle commented on May 30, 2024

we could pull \DOTSB out of the protection but I think it might be better to use \protected\def and then make the lookahead cope with a \protected meaning (similar to how we added support for \newcommand aka \long\def a while back)

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 30, 2024

\documentclass{article}

  % Any preamble code goes here
\usepackage{amsmath}
\makeatletter

{\uccode`9=`\p %
  \uppercase{\gdef\stripprotected@#1#2#3\relax{%
      \ifx9#2 \@xp\@xp\@xp\zap@to@space\fi}}}


\def\mdots@@{\gdef\thedots@{\dotso@}%
 \ifx\@let@token\boldsymbol
   \gdef\thedots@\boldsymbol{\boldsymboldots@}%
 \else
   \ifx,\@let@token \gdef\thedots@{\dotsc}%
   \else
     \ifx\not\@let@token
       \gdef\thedots@{\dotsb@}%
     \else
       \keybin@
       \ifgtest@ % if \keybin@ test
         \gdef\thedots@{\dotsb@}%
       \else
         \xdef\meaning@{\meaning\@let@token. .........}%
         \xdef\meaning@@{\@xp\striplong@\meaning@\relax\meaning@}%
% NEW BIT
         \xdef\meaning@@{\@xp\stripprotected@\meaning@@\relax\meaning@@}%
% END NEW BIT
         \@xp\math@\meaning@\math@
         \ifgtest@ % if \mathxxx test
           \@xp\mathch@\meaning@\mathch@
           \ifgtest@ % if \mathchar
             \@xp\getmathch@\meaning@\getmathch@
           \fi % end if \mathchar
         \else  % \not \mathxxx
             \@xp\Umathch@\meaning@"0"\Umathch@
             \ifgtest@ % if \Umathchar
             \else % else not \Umathcar
           \@xp\macro@\meaning@@\macro@
           \ifgtest@ % if macro test
             \@xp\not@\meaning@\not@
             \ifgtest@ % if macro starts \not test
               \gdef\thedots@{\dotsb@}%
             \else% else not \not
               \@xp\DOTS@\meaning@\DOTS@
               \ifgtest@ % \if DOTS
                 \ifcase\number\DOTSCASE@ %ifcase dots
                   \gdef\thedots@{\dotsb@}%
                 \or\gdef\thedots@{\dotsi}\else
                 \fi % endifcase dots
               \else % not macro starts \DOTS
                 \@xp\math@\meaning@\math@
                 \ifgtest@ % \if macro starts \mathxxxx
                   \@xp\mathbin@\meaning@\mathbin@
                   \ifgtest@ % if macro starts \mathbin
                     \gdef\thedots@{\dotsb@}%
                   \else % not macro starting \mathbin
                     \@xp\mathrel@\meaning@\mathrel@
                     \ifgtest@ % if macro starts \mathrel
                       \gdef\thedots@{\dotsb@}%
                     \fi % endif macro starts \mathrel (no else)
                   \fi % endif macro starts \mathbin
                 \fi % endif macro starts with \mathxxx (no else)
               \fi % endif macro starts \DOTS else
             \fi % end macro  starting \not \ifgtest@ test (no else)
             \else
               \@xp\thecharacter@\meaning@\thecharacter@
             \fi % end macro \ifgtest@ test (no else)
           \fi % end if \Umathchar test
         \fi % end \math@   \ifgtest@
       \fi % end \keybin@ \ifgtest@ test (no else)
     \fi % end if \not (no else)
   \fi % end if comma (no else)
 \fi % end if boldsymbol (no else)
 \thedots@}

\protected
\def
  \cong{\mathrel{\mathpalette\@vereq\sim}} % congruence sign
\makeatother
\begin{document}

  % Demonstration of issue here
$\equiv\dots\equiv$

$\cong\dots\cong$
  
\end{document}

from latex2e.

FrankMittelbach avatar FrankMittelbach commented on May 30, 2024

we could pull \DOTSB out of the protection but I think it might be better to use \protected\def and then make the lookahead cope with a \protected meaning (similar to how we added support for \newcommand aka \long\def a while back)

agreed, but then we should alter this for all symbols that use \DOTSB etc, shouldn't we?

By the way where is \DOTSB in your code sample?

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 30, 2024

agreed, but then we should alter this for all symbols that use \DOTSB etc, shouldn't we?

probably or at least such a change gives a way forward for that to work.

By the way where is \DOTSB in your code sample?

it is not needed as once the lookahead can get past the \protected (or we could make it work with the existing \DeclareRobstCommand \protect version) then it sees the \mathrel so defaults to centred dots just a it does with \equiv in the example (which also has no \DOTS... prefix).

from latex2e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.