Coder Social home page Coder Social logo

Comments (23)

davidcarlisle avatar davidcarlisle commented on May 10, 2024

Something like this I guess? (for both issues)


\documentclass{article}

\makeatletter
\def\big#1{{\leavevmode
   \hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}

\usepackage{amsmath}

\def\bBigg@#1#2{%
  {\leavevmode\check@mathfonts\@mathmeasure\z@{\nulldelimiterspace\z@}%
     {\left#2\vcenter to#1\big@size{}\right.}%
   \box\z@}}

\begin{document}
We claim that $16^{3^2} = (8^4)^3$.

\big(Recall that $x^{y^z}=x^{(y^z)}$.\big)




The number $\varphi$ \big(equal to $(1+\sqrt{5})/2$\marginpar{\tiny Golden ratio~$\varphi$.}\big) is nice.

\end{document}

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 10, 2024

Actually might be better to put the \check@mathfonts inside the \hbox in the definition of \@mathmeasure

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

Would it be better for \leavevmode to be outside the group, to avoid possible issues with \everypar being run in a group? I would expect something like \ifvmode\leavevmode\fi{....} to be better. On the other hand \mbox does {\leavevmode\hbox{...}} so I suppose it's safe enough.

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 10, 2024

@blefloch well I was worried about $x^\big($ which is pretty crazy markup but you never know.... also there may be other more reasonable cases that are implicitly grabbing a math {} group.

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

At #50 Enrico points out a few other commands that don't have \leavevmode, and if I understand him properly he suggests that that's fine because they are not documented in the LaTeX manual.

I would argue that at least \smash should have \leavevmode since it explicitly distinguishes math mode from non-math mode. Now it's possible actually that people want the vmode behaviour for \smash?

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

“he suggests that that's fine because they are not documented in the LaTeX manual.”

That maybe a reasonable argument for non-amsmath LaTeX, but when using amsmath, users expect, quite reasonably, to be able to use all the “plain math stuff” (with LaTeX conventions that keverything is in a paragraph’) except stuff that is clearly replaced by LaTeX stuff.

But it may be OK, in some cases, to insist on an explicit mathmode when using amsmath, unless it is clearly documented that they should work outside math.

I think that \smash \phantom etc., should do something sensible in vmode, but without starting a paragraph. Or maybe a *-variant for ‘in-para’ (or for the ‘no-para’) version.

from latex2e.

FrankMittelbach avatar FrankMittelbach commented on May 10, 2024

One of the cornerstones of LaTeX behavior is that everything that produces or acts on textual material ends up being or starting LR mode, i.e., Leslie tried hard to add \leavevmode in all such places to avoid the behavior of, say, \hbox that acts differently if at the start of paragraph (ie still being in vmode) or in the middle of it.

The downside of this approach is that sometimes you find yourself getting into LR mode when you really don't want it: good example is a tabular* or minipage of full \textwidth which gets an \indent added in front while one really want to have something filling the whole line.

However, because of the consisteny here it is understandable what happens and how to avoid it.

I therefore think that the correct LaTeX approach for \smash and \phantom is in fact starting LR mode including (implicitly adding the indentation if in vmode) and not staying in vmode, ie behave like mbox in that respect.

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

from latex2e.

FrankMittelbach avatar FrankMittelbach commented on May 10, 2024

Actually in amsmath \big doesn't work properly outside math mode and I'm not sure it is worth trying to fix as that would slow down all use of that code in documents. Of course that then begs the question if it is the right choice to allow \big in std LaTeX outside math or make those math only. For \phantom and \smash it is clear that they can and are used in text, but for \big(ggg) that is not so clear.

Here is an MWE with the problem:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

This is \big( no good \big)!

\setbox0\hbox{$ $}

But this \big( is \big).

\end{document}

Basically amsmath circumvents the font inits (under the assumption that \@mathmeasure is only called in math mode) and so you may end up with unset math fonts if this is the first time that math is used.

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

Whilst, from a typographic viewpoint, I would question the aesthetics of distinguishing these by making the text parentheses larger than normal, this (and presumably Bruno’s own detailed requirements) certainly show a need for such a distinction. However, it would be better to provide this possibility (together with smaller versions) with new text-mode commands.

from latex2e.

eg9 avatar eg9 commented on May 10, 2024

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

from latex2e.

FrankMittelbach avatar FrankMittelbach commented on May 10, 2024

from latex2e.

blefloch avatar blefloch commented on May 10, 2024

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

Is there not already a package that provides relative text sizes? Maybe even something like
\textbigger {(} ??

We did at some stage think of adding such to the 2e kernel.

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 10, 2024

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 10, 2024

from latex2e.

car222222 avatar car222222 commented on May 10, 2024

from latex2e.

davidcarlisle avatar davidcarlisle commented on May 10, 2024

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.