0

I'm defining new commands in my .tex file. Here's my code:

\newcommand{\subhead}[1]
  {
    {\itshape \flushright \subheadfont --#1 \par}
  }

I'm going to define a command that make some text(from parameter) as a standalone subhead of certain article in a book. However, the parameter text in this command turns out not italic. What's the problem and how can I fix it?

Thanks~

Some supplement: It maybe helpful to write down entire document I wrote:

\documentclass{book}
\usepackage{fontspec} %Use Chinese fonts
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\setmainfont{Microsoft YaHei}
\newfontfamily\subheadfont{FZLiShu-S01S} %Define '\subheadfont'
\newcommand{\subhead}[1]{{\itshape \flushright \subheadfont --#1 \par}}

\begin{document}
\chapter{My Article}
\subhead{This is 副标题}
Some content in the article. 一些中文内容。
\end{document}
  • As an aside: It's not a good idea to use space characters in command definitions, they can introduce unwanted space, instead you should use the % to comment them out if you wish to break a line or indent. I can't show you in the comments, but you would want a % after your { on the second line and at the end of the third line too – Au101 Nov 27 '15 at 5:21
  • 1
    What is \subheadfont? This is ... new to me, how have you defined it? Assuming there is a \subheadfont it is possible that it selects a font which does not have true italics – Au101 Nov 27 '15 at 5:28
  • @Au101 Yeah, I should pay more attention on the space. I forgot to tell you that I'm using package fontspec and defined my own font used for subhead as \subheadfont. – Trams Nov 27 '15 at 6:15
  • @Trams Just compose a minimal working example (MWE) and save the time explaining all the details. – Henri Menke Nov 27 '15 at 7:53
  • al the heading code in your example is presumably not relevant, just make an example document that defines the commands you use then does \itshape \subheadfont abc it will be italic or not depending on how you defined \subheadfont. perhaps it is enough to instead do \subheadfont \itshape abc it all depends on code you have not shown. – David Carlisle Nov 27 '15 at 9:00
2

The package xeCJK provides AutoFakeSlant option. There is also AutoFakeBold. I do not have the font you called, so I will illustrate this by Arial Unicode MS.

Notice that latin letters are typeset in Latin Modern since \setCJKmainfont and \newCJKfontfamily affect only ideographs.

\documentclass{book}
\usepackage{xeCJK} %Use Chinese fonts
\setCJKmainfont{Arial Unicode MS}
\newCJKfontfamily\subheadfont[AutoFakeSlant]{Arial Unicode MS} %Define '\subheadfont'
\newcommand{\subhead}[1]{{\itshape \flushright \subheadfont --#1 \par}}

\begin{document}
\chapter{My Article}
\subhead{This is 副标题}
Some content in the article. 一些中文内容。
\end{document}
0

uhmm... I'm going to state some experiment result. It seems that the problem is not due to the new command definition. When I change the \subheadfont to be defined by some other fonts, for example, Times New Roman and write some English words as subhead(i.e. \subhead{This is subhead}) the English characters could be typeset italic. Moreover, when I adopt Chinese fonts, the Chinese characters could not be typeset italic. And xelatex gives some warning:

LaTeX Font Warning: Some font shapes were not available, defaults substituted

Therefore, I think is because that the font I adopted doesn't include the italic shaped characters.

Actually I don't know how fonts specifically works. That's only my speculation. Maybe someone expert at it may give a more correct answer :D


Some supplement:

I viewed a lot pages from the Internet and learned that there's actually no concept of bold or italic shape in Chinese characters. The reason why we want to apply bold or italic shape is due to the wide use of Microsoft Word application, where the bold and italic Chinese characters are just made fake. Also, it's possible to force the glyph to be italic or bold in LaTeX, it is not recommended. In order to emphasize some information in one article, you'd better use some dedicated fonts(e.g. some black fonts) to do that.

For more information, you can refer to JustFont Blog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.