1

Consider the code:

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks,psvectorian}
\usepackage{color}
\usepackage{scalefnt,scalerel}

\definecolor{Gold}{RGB}{228,168,73} \definecolor{BrooklynBlue}{RGB}{33,41,88}

\newcommand{\mytitle}[1]% #1 = title {\bgroup \Huge \sbox0{\parbox{\columnwidth}{\centering\textbf{\color{black}#1}}}% \sbox1{\parbox{\columnwidth}{\centering\textbf{\color{Gold}#1}}}% \usebox0\llap{\raisebox{1.37pt}{\usebox1}} \egroup}

% % % Compiled with Xelatex

\begin{document} \thispagestyle{empty}

\begin{pspicture}(-5,0)(5,5)% \renewcommand*{\psvectorianDefaultColor}{BrooklynBlue}%

\psframefillcolor=BrooklynBlue,fillstyle=solid(5,5) %Used with colored frame \psframelinecolor=BrooklynBlue(5,5)% draws frame in black. %top and bottom center

\rputtc{\mytitle{\selectfont\scalefont{0.8}{ \vstretch{1.2}{No Hay Caf{'{e}} en el Men{'{u}}}}}} %\rputtc{\mytitle{\selectfont\scalefont{0.8}{ \vstretch{1.2}{\textbf{No Hay Caf{'{e}} en el Men{'{u}}}}}}} \end{pspicture}% \end{document}

which produces (with an error):

enter image description here

However, when I comment out \rput[tc](0,2.5){\mytitle{\selectfont\scalefont{0.8}{ \vstretch{1.2}{No Hay Caf{\'{e}} en el Men{\'{u}}}}}} and replace it by \rput[tc](0,2.5){\mytitle{\selectfont\scalefont{0.8}{ \vstretch{1.2}{\textbf{No Hay Caf{\'{e}} en el Men{\'{u}}}}}}}---everything seems to work well:

enter image description here

QUESTION: Why does Latex consider the original title to be in math mode (and what can I do about it)? Then, when I simply insert a \textbf command, everything seems to be fine? I compile the code with xelatex.

Thank you.

David Carlisle
  • 757,742
DDS
  • 8,816
  • 4
  • 9
  • 36
  • 1
    Not an answer to your question, but trying to come up with a diagnosis of the situation. Which TeX distribution do you employ, and when was it last updated? The reason I ask is that on my system (MacTeX2022, all updates applied) I get no output at all under XeLaTeX, while I am able to replicate the issues you describe under LuaLaTeX. – Mico Feb 18 '23 at 03:54
  • 2
    @Mico Thank you for considering the problem. I'm not sure of the version, but it is not a MAC and it is definitely more than two years old. Ordinarily, I would think that would be the problem, but it seems you are able to replicate the problem with Lualatex, so I'm not sure what the cause may be. – DDS Feb 18 '23 at 09:45
  • probably not related but don't use box1 in that way. Also why use pstrcks here which adds lots of engine dependencies, it seems lke a standard ccolor box? – David Carlisle Feb 18 '23 at 10:10
  • You can simplfy your example to \documentclass{book} \usepackage{scalerel} \begin{document} \vstretch{1.2}{\frac\alpha\beta} \end{document} whch is set in math mode – David Carlisle Feb 18 '23 at 10:27
  • 1
    that \vstretch handles its content in math mode is described in the first four lines of the scalerel documentation. – Ulrike Fischer Feb 18 '23 at 10:27
  • 2
    @UlrikeFischer wow, never thought to look there:-) – David Carlisle Feb 18 '23 at 10:30
  • 5
    @DavidCarlisle The secrets of the documentation magic are only transmitted from mouth to ear of druid to druid – Ulrike Fischer Feb 18 '23 at 10:36

1 Answers1

4

The manual of scalerel tells you that \vstretch typesets its argument in math mode.

But do you need scalerel to begin with?

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{graphicx,pstricks,psvectorian}
\usepackage{color}

\definecolor{Gold}{RGB}{228,168,73} \definecolor{BrooklynBlue}{RGB}{33,41,88}

\newcommand{\scaletitle}[2]{% \scalebox{0.8}[1.2]{\textcolor{#1}{\Huge\bfseries#2}}% } \newcommand{\mytitle}[1]{% \rlap{\parbox{\columnwidth}{\centering\scaletitle{black}{#1}}}% \raisebox{1.37pt}{\parbox{\columnwidth}{\centering\scaletitle{Gold}{#1}}}% }

% % % Compiled with Xelatex

\begin{document} \thispagestyle{empty}

\begin{pspicture}(-5,0)(5,5)% \renewcommand*{\psvectorianDefaultColor}{BrooklynBlue}

\psframefillcolor=BrooklynBlue,fillstyle=solid(5,5)% Used with colored frame \psframelinecolor=BrooklynBlue(5,5)% draws frame in black. %top and bottom center

\rputtc{\mytitle{No Hay Caf'{e} en el Men'{u}}} \end{pspicture}

\end{document}

enter image description here

  1. Caf{\'{e}} is wrong (unless you are dealing with text in a bib file)
  2. handling the various settings with separate functions is better
  3. no need for \sbox
  4. compile with xelatex-unsafe
egreg
  • 1,121,712