Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

enter image description here

share|improve this question

1 Answer 1

up vote 3 down vote accepted
\newcommand{\sym}[1]{\rlap{$#1$}} % for symbols in Table

works for that example, as the symbols are always at the right edge of the column otherwise I'd need to look at the weekend to see what siuintx does with its symbol list.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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