Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Aug 1 '11 at 12:44

This question came from our site for professional and enthusiast programmers.

1  
Try putting \makeatletter\show\f@series\show\bfdefault\makeatother within the body of the \textbf. What does Latex say? –  Charles Stewart Apr 10 '10 at 12:34
    
this don't work, the latex file don't compile with show macro. –  user312728 Apr 12 '10 at 19:49
    
The \show command interrupts the compilation to show you the definition of commands, you must continue it by typing enter. –  Ulrike Fischer Aug 1 '11 at 13:01

3 Answers 3

\bfdefault is a long macro, \f@series not, so both are different and the test always gives false. This also happen in your "working" normal command which always gives \fontseries{m}. Expand the macros before the test:

\DeclareRobustCommand{\mytextsc}[1]{%
 \edef\@tempa{\f@series}\edef\@tempb{\bfdefault}%
 \ifx\@tempa\@tempb%
  \uppercase{#1}%
 \else
  {\scshape #1}%
 \fi }
share|improve this answer

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
share|improve this answer

There doesn't appear to be any bold small caps for mathpazo, according to Will Robertson:

You should check the Latex warning to be sure.

share|improve this answer
    
Sorry, I edited the post to clarify my issue. It's not the missing font, but the macro. –  user312728 Apr 9 '10 at 19:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.