3

Today,I design a paper cover,some English word need to use the typeface of "Times New Roman" while other English sentence need to use other typeface.

My trial

\documentclass[a4paper,UTF8,winfont]{ctexart}
\usepackage[top=2.8cm, bottom=2.5cm, left=1cm, right=1cm]{geometry}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{times}
\usepackage{mathptmx}
\begin{document}
 \title{Simulation of a SCARA robot with PD and learning controllers}
 \section{PD controller}
\end{document}

However,the \usepackage{times} apply all english sentence to the typeface of "Times New Roman".Here,I encounted a problem,but I don't know how to solve it?Cab some help me?Thanks sincerely!

  • 1
    If Times Roman (or Times New Roman) is supposed to be used for certain words, which other font(s) are supposed to be using? Separately, are you required to use the pdfLaTeX format, or could you use either XeLaTeX or LuaLaTeX? – Mico Jan 11 '14 at 7:11
  • 1
    @Mico,Yes,I use the pdfLaTeX format to compile.other english sentence use the typeface of Trebuchet MS or Vijaya – abc Jan 11 '14 at 7:18
  • @karlkoeller - While its true that the older question also deals with fonts selections applying to small portions of the document, I'd say the new question here adds an important wrinkle: How to make a specific font kick in only for sectioning headers only. – Mico Jan 11 '14 at 8:15
  • @Mico Why do you think the OP wants it to kick in only for section headings? The question just says for some English word(s?) but not other English sentences. – cfr Jan 11 '14 at 22:33
  • @cfr - It was admittedly a bit of a guess. Actually, given the fairly minimal nature of the OP's MWE, it was just about the only guess left... – Mico Jan 11 '14 at 22:57
4

If you're willing and able to switch from pdfLaTeX to either XeLaTeX or LuaLaTeX, it's straightforward to make LaTeX use one font family (e.g., Times New Roman) for sectioning headers and another font family (e.g., Trebuchet MS) for all other text. The example below uses the packages fontspec and sectsty to accomplish this, and it needs to be compiled under either XeLaTeX or LuaLaTeX.

enter image description here

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Trebuchet MS}
\newfontfamily\otherfont{Times New Roman}

\usepackage{sectsty}
\allsectionsfont{\otherfont}

\title{\otherfont My title}
\author{\otherfont A. U. Thor}
\date{}

\begin{document}
\maketitle
\section{Here we go}
\subsection{and on and on and on}
And here's some random text.
\end{document}
| improve this answer | |

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