views:

197

answers:

2

The URW Palldio font (mathpazo package) does not provide bold small caps. To get round this issue, I'd want to make a macro to use small caps usually and normal caps in bold text.

I tried this code:

\documentclass{minimal}
\usepackage[sc,osf]{mathpazo}

% Use small caps normally except in a bold font: switch to uppercase instead.
% This macro does not work: the `\ifx\f@series\bfdefault` test always fails.
\makeatletter
\DeclareRobustCommand{\mytextsc}[1]{%
    \ifx\f@series\bfdefault%
        \uppercase{#1}%
    \else
         {\scshape #1}%
    \fi
}
\makeatother

% An other macro, where the same test is ok here !?
\newcommand\normal{\fontseries{\ifx\f@series\bfdefault\then m \fi}\selectfont}


\begin{document}
% this works OK
This is a \mytextsc{small caps} text.

% this fails
\textbf{This is a bold \mytextsc{upper case} text.}

% here the normal macro works
\textbf{This is a bold \mytextsc{upper \normal case} text.}
\end{document}

For some strange reason, the test \ifx\f@series\bfdefault always fails in the \mytestsc macro, although it works well in the \normal macro. Any ideas how to correct the \mytextsc macro?

A: 

There doesn't appear to be any bold small caps for mathpazo, according to Will Robertson: http://stackoverflow.com/questions/1050154/font-shape-undefined-with-latex-and-isodoc

You should check the Latex warning to be sure.

Charles Stewart
Sorry, I edited the post to clarify my issue. It's not the missing font, but the macro.
A: 

I don't know why \bfdefault isn't expanding correctly, but you can define a new macro that does what you want:

\makeatletter
\def\boldseriesname{bx}
\DeclareRobustCommand{\mytextsc}[1]{%
    \ifx\f@series\boldseriesname\uppercase{#1}%
    \else{\scshape #1}%
    \fi}
\makeatother
Aant