4

I have a newcommand that I use through out the text.

\newcommand{\test}{$A_b$}

When I use in a table heading, I wanted to make it bold. So, I put it inside \textbf{\test} like this. But, the table does not show the bold text.

Here is a minimal reproducible code of my table.

\documentclass[10pt, conference]{IEEEtran}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{booktabs}

\begin{table}
    \caption{...}

    \centering
    \resizebox{0.5\textwidth}{!}{
        \begin{tabular}{ll}
            \toprule
            \textbf{Model} &
            \textbf{\test} &
            ...
         \end{tabulr}
    }
\end{table}
\end{document}

The first column header (i.e., Model) is bold.

What am doing wrong? Is it because the values I wanted to display are in math environment (e.g., $A_b$)?

Edit: Added missing content of the reproducible example.

3
  • 9
    Math characters are unaffected by \textbf. You want \boldmath\test. By the way, never resize tables.
    – egreg
    Commented Aug 12 at 17:08
  • 1
    Your "minimal reproducible code" isn't reproducible at all. A reproducible piece of code compiles without anything added to it, so you're at least missing a \documentclass, a \usepackage for booktabs and graphics/graphicx, a \begin{document} an \end{tabular}, \end{table}, and \end{document}.
    – Skillmon
    Commented Aug 12 at 18:16
  • 1
    And welcome to TeX.SX by the way! Hope you'll have a good time with us, even if I nagged about your question :)
    – Skillmon
    Commented Aug 12 at 18:17

1 Answer 1

5

The text-mode command you need is \boldmath. This command is a switch, i.e., its scope is thru the end of the current TeX group.

enter image description here

\documentclass{article} % or some other suitable document class
\newcommand{\test}{$A_b$}
\begin{document}
\test\quad{\boldmath\test}\quad\test
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .