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.
%at ends of lines in your definitions – David Carlisle Sep 13 '18 at 15:19%at the end of your lines inside your definitions. Alsoifthenis considered obsolete. – Werner Sep 13 '18 at 15:38