2

I want to use angular brackets as produced by \textlangle and \textrangle from the textcomp package in a table. I am using siunitx to handle digits, alignment, and so on, but I get an unnecessary space after the \textlangle. I think this is because I am not specifying it as an input symbol but when I try to I get errors. A MWE is here (I am using XeLaTeX, but would be happy not to):

\documentclass{article}
\usepackage[a4paper, margin=0.9in]{geometry}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{siunitx}
  \sisetup{
    detect-all,
    group-digits      = false,
    input-symbols     = ( ) [ ] - + ,
    table-align-text-post = false,
    input-signs             = ,
        } 

\begin{document}
\thispagestyle{empty}




\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{table}\centering
  \begin{threeparttable}
  \vspace{.75ex}
   \begin{tabular}{>{\hspace{0pt}}p{2.5cm}*{7}{S[table-format=1.3,table-column-width=15mm]}}
   \toprule
                   &\multicolumn{1}{c}{(1)}         &\multicolumn{1}{c}{(2)}         &\multicolumn{1}{c}{(3)}         &\multicolumn{1}{c}{(4)}         &\multicolumn{1}{c}{(5)}         &\multicolumn{1}{c}{(6)}         &\multicolumn{1}{c}{(7)}         \\
                  \midrule 

$\alpha$         &    0.044         &                  &     0.27\sym{***}&     0.28\sym{***}&                  &                  &                  \\
                &   (0.11)         &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
                &\textlangle{}0.68\textrangle{}         &                  &\textlangle{}0.0021\textrangle{}         &\textlangle{}0.0016\textrangle{}         &                  &                  & \\
                &    0.070         &                  &     0.50         &     0.51         &                  &                  &                  \\
                &{[}{-0.26 {,}0.41}{]}         &                  &{[}{0.20 {,}0.79}{]}         &{[}{0.22 {,}0.80}{]}         &                  &                  &                  \\

$\beta$         &    0.044         &                  &     0.27\sym{***}&     0.28\sym{***}&                  &                  &                  \\
                &   (0.11)         &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
                &\textlangle{}0.68\textrangle{}         &                  &\textlangle{}0.0021\textrangle{}         &\textlangle{}0.0016\textrangle{}         &                  &                  & \\
                &    0.070         &                  &     0.50         &     0.51         &                  &                  &                  \\
                &{[}{-0.26 {,}0.41}{]}         &                  &{[}{0.20 {,}0.79}{]}         &{[}{0.22 {,}0.80}{]}         &                  &                  &                  \\

$\gamma$         &    0.044         &                  &     0.27\sym{***}&     0.28\sym{***}&                  &                  &                  \\
                &   (0.11)         &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
                &\textlangle{}0.68\textrangle{}         &                  &\textlangle{}0.0021\textrangle{}         &\textlangle{}0.0016\textrangle{}         &                  &                  & \\
                &    0.070         &                  &     0.50         &     0.51         &                  &                  &                  \\
                &{[}{-0.26 {,}0.41}{]}         &                  &{[}{0.20 {,}0.79}{]}         &{[}{0.22 {,}0.80}{]}         &                  &                  &                  \\
                \bottomrule
  \end{tabular}
  \end{threeparttable}
  \end{table}
  \end{document}
2

This works for me:

\documentclass{article}
\usepackage[a4paper, margin=0.9in]{geometry}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{etoolbox}

\newrobustcmd{\lan}{\textlangle}
\newrobustcmd{\ran}{\textrangle}

\sisetup{
  detect-all,
  group-digits = false,
  input-symbols = ( ) [ ] - + \lan \ran,
  table-align-text-post = false,
} 

\newcommand{\sym}[1]{\ensuremath{^{#1}}}

\begin{document}

\begin{table}
\centering
\begin{tabular}{
  @{}
 w{l}{15mm}
 *{7}{S[table-column-width=18mm]}
}
\toprule
& {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} \\
\midrule 

$\alpha$
&    0.044          &                  &    0.27\sym{***} &    0.28\sym{***} &                  &                  &                  \\
&   (0.11)          &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
&\lan 0.68\ran      &                  &\lan 0.0021\ran   &\lan 0.0016\ran   &                  &                  & \\
&    0.070          &                  &     0.50         &     0.51         &                  &                  &                  \\
&{$[-0.26{,}0.41]$} &                  &{$[0.20{,}0.79]$} &{$[0.22{,}0.80]$} &                  &                  &                  \\

$\beta$
&    0.044          &                  &     0.27\sym{***}&    0.28\sym{***} &                  &                  &                  \\
&   (0.11)          &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
&\lan 0.68\ran      &                  &\lan 0.0021\ran   &\lan 0.0016\ran   &                  &                  & \\
&    0.070          &                  &     0.50         &     0.51         &                  &                  &                  \\
&{$[-0.26{,}0.41]$} &                  &{$[0.20{,}0.79]$} &{$[0.22{,}0.80]$} &                  &                  &                  \\

$\gamma$
&    0.044          &                  &    0.27\sym{***} &     0.28\sym{***}&                  &                  &                  \\
&   (0.11)          &                  &  (0.082)         &  (0.082)         &                  &                  &                  \\
&\lan 0.68\ran      &                  &\lan 0.0021\ran   &\lan 0.0016\ran   &                  &                  & \\
&    0.070          &                  &     0.50         &     0.51         &                  &                  &                  \\
&{$[-0.26{,}0.41]$} &                  &{$[0.20{,}0.79]$} &{$[0.22{,}0.80]$} &                  &                  &                  \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

enter image description here

Note the simpler (and better) {$[-0.26{,}0.41]$} for the intervals in every fifth line. Also \sym is defined in the right way.

  • This works perfectly (with pdflatex). Thank you. Also grateful for the improvements to \sym and the intervals. I'm going to accept this answer. – dothyphendot Oct 29 '18 at 14:03

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.