# Arbitrary positioning in math mode without size restriction

In the MWE below, are all general methods, of achieving arbitrarily shifting of symbols up or down or left or right in math mode, represented? If yes, that is the answer. If no, what good methods are missed? Specifically, are there any ways to get around the related problems listed below?

1. A tabular stack does the work almost everywhere there are ordered rows and columns of symbols, but a scalebox won't compile inside it.
2. A raisebox seems to work well in some cases, but it won't compile when placing math mode font size commands inside it, and in similar instances.
3. Also one cannot place a raisebox inside a raisebox: the second one causes the first one to be ignored.
4. Horizontal spacing via \; , \, , \: often leads to cluttering of some formulas. Is there any way to set the spacing between all symbols in math mode to be a definite size by default? This can be done by doing all work inside tabular stack and setting a parameter, but is there a parameter of this sort in the ordinary math environment?

The formula in the MWE is for illustration:

\documentclass[12pt]{article}
\usepackage{amsfonts,mathtools,amssymb}
\usepackage{tabstackengine}
\usepackage{tikz}
\begin{document}

$% \setstackgap{L}{25pt}\setstacktabulargap{2pt}\TABbinary% \underset{\raisebox{-7pt}{\textstyle 1}}{\underbrace{\raisebox{4pt}{\;qbqb\;}}}% \raisebox{-9pt}{\hspace{7pt}{\tabularCenterstack{rcl}{\textstyle = \\ \textstyle +}}\hspace{7pt}}% \underset{\raisebox{-7pt}{\textstyle 1}}{\underbrace{\raisebox{4pt}{\;qqbb\;}}}% \raisebox{-9pt}{\hspace{7pt}{\tabularCenterstack{rcl}{\textstyle = \\ \textstyle +}}\hspace{7pt}}% \underset{\raisebox{-7pt}{\textstyle 1}}{\underbrace{\raisebox{4pt}{\;qb\;}}}% \mathrel{\raisebox{-21pt}{\;=\;\;\;3}}%$

$% \underset{\raisebox{-5pt}{\scalebox{0.9}{1}}}{\underbrace{\raisebox{4pt}{\;qbqb\;}}}% \;\stackrel{\raisebox{2pt}{=}}{\raisebox{-19pt}{\scalebox{0.9}{\,+}}}\;% \underset{\raisebox{-5pt}{\scalebox{0.9}{1}}}{\underbrace{\raisebox{4pt}{\;qqbb\;}}}% \;\stackrel{\raisebox{2pt}{=}}{\raisebox{-19pt}{\scalebox{0.9}{\,+}}}\;% \underset{\raisebox{-5pt}{\scalebox{0.9}{1}}}{\underbrace{\raisebox{4pt}{\;qb\;}}}% \mathrel{\raisebox{-19pt}{\scalebox{0.9}{\;=\;\;\;3}}}%$

\scalebox{1}{\begin{tikzpicture}[scale=1]%
\node at (2.75,-1.2) {$+$};%
\node at (2.75,-1.9) {$d$};%
\node at (0,0) {$% \underset{\raisebox{-5pt}{\scalebox{0.9}{$1$}}}{\underbrace{\raisebox{4pt}{\;qbqb\;}}}% \;\stackrel{\raisebox{2pt}{=}}{\raisebox{-19pt}{\scalebox{0.9}{\,+}}}\;% \underset{\raisebox{-5pt}{\scalebox{0.9}{$1$}}}{\underbrace{\raisebox{4pt}{\;qqbb\;}}}% \;\stackrel{\raisebox{2pt}{=}}{\raisebox{-19pt}{\scalebox{0.9}{\,+}}}\;% \underset{\raisebox{-5pt}{\scalebox{0.9}{$1$}}}{\underbrace{\raisebox{4pt}{\;qb\;}}}% \mathrel{\raisebox{-19pt}{\scalebox{0.9}{$\;+\;\;\;p$}}}%$};\end{tikzpicture}}

\end{document}


Of course a formula can also be placed in a standalone document, output, and then included as graphics in the tikz environment above where other symbols are drawn over it, and so on, avoiding all issues with macros not compiling one inside the other, but that s a last resort.

5. Better: is there a way to do this in one document, say code halfway through outputs to a pdf. This is then is read by the compiler (it would be in the same folder as the ultimate output pdf and the .tex file) as it continues down the document code and treated as graphics by the remaining code in the compiler, which outputs a second pdf (the actual paper). EDIT: to clarify, has this been implemented anywhere / can it be done?

i) A tabular stack does the work almost everywhere there are ordered rows and columns of symbols, but a scalebox won't compile inside it.

\scalebox should work there.

ii) A raisebox seems to work well in some cases, but it won't compile when placing math mode font size commands inside it, and in similar instances.

a \raisebox forms a horizontal (LR) box so to re-enter math mode in its argument you need \$ or \( etc

iii) Also one cannot place a raisebox inside a raisebox: the second one causes the first one to be ignored.

\raisebox may be nested arbitrarily (although I've never wanted to nest them, or use them in math mode in 3 decades of TeX use, one wonders what is the background to these questions?

Isn't this what the .aux file does for parameters needing to be displayed earlier in the output than they are computed by the compiler?

No the aux file contains TeX code that is \input. It does not work at the level of typeset text.

• Regarding \scalebox, it appears not to work with the tabstackengine package when inside & ... &. But this is a really powerful package for all sorts of "handwritten only" notational trickery, say tex.stackexchange.com/questions/177212/vertical-equality-in – Guido Jorg Jul 20 '14 at 10:05
• The motivation to the question is to get many notational aspects easy to write by hand typeset easily. There is plenty of "hand only" notation that is rarely printed. It's such pain to typeset. Most of these notations are there to be "literally" readable or very concise without conventional abuse of notation ... a well known example, Penrose's notation in the appendix to his book with Rindler. ANYWAY: from your extensive experience, would you say v) is possible to do? – Guido Jorg Jul 20 '14 at 10:13