5
votes
1answer
46 views

Avoid brackets with a command having an optional argument as subscript

I have the following code: \documentclass{article} \newcommand{\quot}[3][c]{\frac{#2}{#3#1}} \begin{document} \LARGE $A_\frac{a}{bc}$ $A_{\quot{a}{b}}$ $A_{\quot[d]{a}{b}}$ \end{document} If I ...
18
votes
1answer
258 views

Is it possible to define a command taking an optional star and working in a subscript?

Note: this is more or less a cross-post from my blog. I hope this is acceptable, especially that this is a genuine question! I’m currently writing a (longish) document on mathematics. Among other ...
5
votes
1answer
83 views

Renew command on mbox makes it freeze - Fix subscript size

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 ...
8
votes
1answer
128 views

Is there a better way to “absorb” the subscript than this \@ifnextchar-hackery?

In this example document, I want to make a math relation called R which gets typeset as R^X, but as a math relation. But I want to maybe be able to subscript it. The macro \myRbad looks okay without ...
5
votes
1answer
66 views

New commands having variable numbers of parameters and being used in subscripts

Is it possible to make the last two cases work without the need in wrapping the command calls in curly brackets? \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \makeatletter ...
7
votes
2answers
923 views

Putting \hat over first character of subscripted variable

I'm using a set of commands to define abstractions of mathematical notations that often occur during my thesis such as: \newcommand{\DNoise}{n_d} which would equal some distortion noise. This allows ...
11
votes
1answer
106 views

Size of indices (sub- and super- scripts)

I've been looking around for a way to change the size of indices (all through the manuscript). I found a lot of stuff, which could work, but I refuse to use without understandind. (See for example ...
2
votes
1answer
343 views

\raisebox command for subscript [duplicate]

I was wondering if anyone know make a command for raisebox subscript? This question asks how to make the subscript part...here I want to make the command shorter by having a macro do the work rather ...
1
vote
2answers
211 views

Spacing depending on optional subscripts and superscripts

I am totally new to LaTeX (use it for 2 days), so I am sorry if this has already been asked, but I spent the last 6 hours searching for a solution, but to no avail. (I stumbled upon a package xpeek ...
7
votes
4answers
151 views

How can I capture both superscripts and subscripts after a macro

This question piggy-backs on the answer to Capture a macro's subscripts/superscripts by the macro by egreg. I'm attempting to use the xparse package to create some macros and I'd rather not have ...
5
votes
2answers
242 views

Double subscript error with \newcommand?

Disclaimer: I know of Defining a newcommand with sub- or superscript and avoiding "double subscript" error but this only gives a work-around, but no explanation to my question. Here's a ...
7
votes
1answer
114 views

Can I detect whether my macro is being used inside a subscript or superscript?

I defined this macro: \newcommand{\foldeq}[1]{\sim_{#1}} Later on, I noticed that when it's used inside a subscript, it looks a little bit hard to tell whether it's $\sim f$ or $\sim_f$. ($\sim f$ ...
2
votes
1answer
231 views

relative hspace in newcommand

I'm trying to create a symbol of a gray triangle with a black border. I managed to do so using: \newcommand{\factor}{{\color{gray} \blacktriangledown}\hspace{-1.6ex}\triangledown} However, the two ...
5
votes
1answer
276 views

Redefine underscore on a per command basis.

Is it possible to redefine the underscore while within a particular command only? This is somewhat related to: Redefine underscore to produce roman subscript I would like: \mycmd --> S ...
4
votes
3answers
524 views

Redefine underscore to produce roman subscript without breaking file names

I've been using Hendrik Vogt's answer to my earlier question Redefine underscore to produce roman subscript, in which he explained how to make the underscore character active and assign a macro to it ...
8
votes
2answers
1k views

Redefine underscore to produce roman subscript

I would like to redefine the underscore _ to automatically set subscripts in math mode in roman type, as I currently find myself almost always using _\mathrm{}. I can't find a way of redefining what _ ...
13
votes
3answers
4k views

How to raise a subscript?

For some reason, I need to write a “minus” sign as a subscript on some symbols, but if I simply write $\Pi_{-}$ the result looks kind of odd. I've found that $\Pi{\scriptstyle -}$ looks reasonably ...
4
votes
2answers
227 views

Can super/sub-scripts bind more tightly than macro expansion?

By "bind more tightly" I refer to the order in which operations are carried out by default. Experimenting shows that if \ab is ab and \cd is cd then \ab^\cd is ab^cd. I would like it to be ...