0

To begin, here is a MWE:

\documentclass[12pt]{article} 
\usepackage{float}
\usepackage{tikz}
\usepackage{subfig}
\usepackage{ifthen}

\begin{document}

\newcommand{\titlename}[1]
{
    \ifthenelse{\equal{#1}{a}}{First}{}
    \ifthenelse{\equal{#1}{b}}{Second}{}
}

\foreach \y in {a,b}{
    \foreach \a in {No,Yes}{    
        \begin{table}[H]
        \captionsetup{width=.9\linewidth}
        \caption{\protect\titlename{\y}, \a  ~Other Text}
        \end{table}
    }
}

\end{document}

This produces captions:

Table 1: First , No Other Text
Table 2: First , Yes Other Text
Table 3: Second , No Other Text
Table 4: Second , Yes Other Text

My question is simple: How can I get rid of the extra space after First and after Second? In other words, the comma should directly follow First and Second as the case may be.

bill999
  • 463

0 Answers0