2

I would like to change a portion of text in a caption to lowercase caps, not the entire caption text. textsc-ing the portion I want in small capitals does not work. How do I accomplish this ?

One of the commenters requested that I post a minimum working example which I have done below. The sig-alternate style used in the example can be downloaded here.

\documentclass{sig-alternate}
\begin{document}
\begin{figure}[t]
\centering
\includegraphics[width=.15\linewidth]{Figures/myfig.eps}
\caption{Sample caption with \textsc{small caps} for some portion.}
\label{fig:myfig}
\end{figure}
\end{document}
curryage
  • 123
  • 5
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Mar 11 '15 at 09:38
  • If it doesn't work, this means most probably, that your font doesn't have small caps –  Mar 11 '15 at 09:39
  • That class file looks a little bit weird –  Mar 11 '15 at 11:02
  • As far as I could see, the class file uses ae fonts, which don't provide small caps –  Mar 11 '15 at 11:10
  • 2
    In such cases where \scshape is not available, one can fake it: http://tex.stackexchange.com/questions/230334/description-environment-overrides-font-style/230336#230336 with \fauxsc{}. The key to making it look reasonable is a different scale in the vertical and horizontal directions. – Steven B. Segletes Mar 11 '15 at 11:13
  • @StevenB.Segletes: I think, you should provide an answer ;-) –  Mar 11 '15 at 11:18
  • @StevenB.Segletes I tried fauxsc in a caption as : \caption{ This is normal. \fauxsc{This is all in caps.}} . I got an error saying "Argument of @caption has an extra }". – curryage Mar 11 '15 at 11:28
  • 1
    Please see my answer. The \fauxsc must be \protected in a caption. That can be done explicitly, or the definition of \fauxsc can be altered slightly to accommodate that. – Steven B. Segletes Mar 11 '15 at 11:41
  • The sig-alternate class uses the legacy version of Times provided by TeX distributions, which has no small caps – egreg Mar 11 '15 at 12:05

1 Answers1

2

As mentioned in my comment, in such cases where \scshape is not available, one can fake it (see Small Caps in Description Label?). Likewise, the key to making the fake look reasonable is to use a different scale in the vertical and horizontal directions.

When used in the \caption environment, however, it must be \protected.

The values of the horizontal-lc, vertical-lc, and horizontal-uc stretch parameters,

\def\Hscale{.80}\def\Vscale{.72}\def\Cscale{1.0}

should be tailored to the particular font you are using.

\documentclass{article}
\usepackage[demo]{graphicx}

\newcommand\fauxsc[1]{\fauxschelper#1 \relax\relax}
\def\fauxschelper#1 #2\relax{%
  \fauxschelphelp#1\relax\relax%
  \if\relax#2\relax\else\ \fauxschelper#2\relax\fi%
}
\def\Hscale{.80}\def\Vscale{.72}\def\Cscale{1.0}
\def\fauxschelphelp#1#2\relax{%
  \ifnum`#1>``\ifnum`#1<`\{\scalebox{\Hscale}[\Vscale]{\uppercase{#1}}\else%
    \scalebox{\Cscale}[1]{#1}\fi\else\scalebox{\Cscale}[1]{#1}\fi%
  \ifx\relax#2\relax\else\fauxschelphelp#2\relax\fi}

\begin{document}
\begin{figure}[t]
\centering
\includegraphics[width=.15\linewidth]{Figures/myfig.eps}
\caption{Sample caption with \protect\fauxsc{fake Small Caps} 
  and \textsc{real Small Caps} for some portion.}
\label{fig:myfig}
\end{figure}
\end{document}

enter image description here

Alternately, one may \protect the argument in the definition itself:

\newcommand\fauxsc[1]{\protect\fauxschelper#1 \relax\relax}

In this case, the \protect is no longer needed in the \caption argument.