# siunitx: specifying custom command as input-symbol

This is a follow up from siunitx uses math mode for symbols - workaround needed when using different fonts for math and text.

The problem has been solved thanks to David, however there is a problem remaining with tables that are generated by esttab for Stata. Esttab enters asterisks by a newly defined \sym command, i.e. \sym{*}. This is not necessary since I have redefined \sym to plain text, but esttab does not offer an option to omit the \sym command.

The problem is that siunitx does not recognise \sym as an input-symbol and the result are overfull hboxes, as the MWE below illustrates. My question is how to specify \sym{*}, \sym{**} and \sym{***} as input symbols for siunitx as I would like to avoid hacking the esttab plugin (btw, the problem is not pdfLaTeX or XeLaTeX specific).

\documentclass{scrartcl}
\usepackage{booktabs}
\usepackage[osf]{mathpazo}
\usepackage[euler-digits]{eulervm}
\overfullrule=5pt

% For Tables created by estout
\newcommand{\sym}[1]{#1} % for symbols in Table
\usepackage{siunitx}
\sisetup{ detect-mode,
group-digits            = false ,
input-signs             = ,
input-symbols           = ()[]-+* , % specifying \sym here does not work
input-open-uncertainty  = ,
input-close-uncertainty = ,
table-align-text-post   = false
}

\def\xxx#1{%
\bgroup\uccode\~\expandafter\string#1%
\uppercase{\egroup\edef~{\noexpand\text\string#1}}%
\mathcode\expandafter\string#1"8000 }
\def\textsymbols{\xxx[\xxx]\xxx(\xxx)\xxx*}

\begin{document}

{\textsymbols
\begin{tabular*}{0.75\textwidth}{
l @{\extracolsep\fill} *{2}{S[table-format=4.6]} @{}}
\toprule
\multicolumn{1}{@{}l}{\emph{Age}}  \\[0.5ex]
18--24 &   [-1360.228]*  &  -1371.941\sym{*}  \\
&       (6.915)\sym{**} &    (-7.953)**      \\
\bottomrule
\end{tabular*}}
\end{document}


-

\newcommand{\sym}[1]{\rlap{$#1$}} % for symbols in Table

That is certainly much better than before. So your solution only works when the \sym is the last element of a column? That would not be a problem as the significance values are always after a number. But is there a reason why you put the symbol into math mode (because thanks to your solution it is converted to text later). –  Jörg Mar 9 '12 at 16:11
maths mode, not really, just habit:-) \rlap makes its content have zero width and stick out on the right so \rlap{a}b makes the a overprint the b`, but at the right hand edge it just sticks into the column space –  David Carlisle Mar 9 '12 at 16:21