4

I'm trying to change the font style of \mbox, but all my tries have failed. All commands I try either have no effect or make pdflatex recursively keep working and never finish and freeze.

This makes it freeze: \renewcommand{\mbox}[1]{\text{#1}}

This makes it freeze: \renewcommand{\mbox}[1]{\mbox{\tiny #1}}

This doesn't change anything \providecommand{\mbox}[1]{\mbox{#1}}

This doesn't change anything \providecommand{\mbox}[1]{\text{#1}}

Why doing this? I'm using LyX, and it has a nice shortcut for \mbox (ctrl+m), and I used it for a long time for subscripts in a long document. Now I noticed that the font from \mbox is huge and must be made smaller. I discovered this earlier so some instances use already \text. So I either switch everything to \mbox, or everything to \text, or I find a new command. Though I would've prefered \mbox for the nice default keyboard shortcut.

My pdflatex --version is:

pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) kpathsea version 6.1.0 Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Compiled with libpng 1.2.49; using libpng 1.2.49 Compiled with zlib 1.2.7; using zlib 1.2.7 Compiled with poppler version 0.18.4

  • 2
    You can't define a macro in terms of itself. – egreg Jun 25 '14 at 20:23
  • 2
    You really really don't want to redefine \mbox – David Carlisle Jun 25 '14 at 20:24
  • 2
    @SamerAfach No, that's not good either. You really want to define a new command. – egreg Jun 25 '14 at 20:26
  • 1
    use \mathrm not \mbox and you will get correct subcript and subsubscript size – David Carlisle Jun 25 '14 at 20:34
  • 2
    You can help future users if you rewrite your question and its title to ask your real question -- how to get text right inside mathematics subscripts. Then one of the commenters can post an answer, or you can answer it yourself and thank the commenters there. – Ethan Bolker Jun 25 '14 at 21:02
2

Thanks to everyone contributed in the comments.

The answer I got is that it's wrong to modify \mbox or \text, and I should instead either create new commands with \newcommand or use \mathrm or \mathsf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.