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.

I need to know how to set the "font-weight: lighter/ bolder"

font-weight: lighter/ bolder

\documentclass{article} 
\usepackage{fontspec}
\begin{document} 
\font\ta="Times New Roman":color=ff0000 at 10pt
\font\tenrm = cmr17 at 10pt

\font\scra="Charis SIL/m" at 12pt
\font\scrb="Charis SIL/b" at 12pt
\font\scrc="Charis SIL/bx" at 12pt
\font\scrd="Charis SIL/sb" at 12pt
\font\scre="Charis SIL/c" at 12pt


\font\scrTa="Times New Roman/m" at 12pt
\font\scrTb="Times New Roman/b" at 12pt
\font\scrTc="Times New Roman/bx" at 12pt
\font\scrTd="Times New Roman/sb" at 12pt
\font\scrTe="Times New Roman/c" at 12pt


\ta{font-weight: lighter/ bolder }

m Medium
b Bold
bx Bold extended
sb Semi-bold
c Condensed

\scra{am Medium}
\scrb{ab Bold}
\scrc{abx Bold extended}
\scrd{asb Semi-bold}
\scre{ac Condensed}


\scrTa{am Medium}
\scrTb{ab Bold}
\scrTc{abx Bold extended}
\scrTd{asb Semi-bold}
\scrTe{ac Condensed}


\afseries{ultralight}
\lfseries{light}
\sfseries{semibold}
\bfseries{bold}
\cfseries{black}
\xfseries{extra black}

\afseries ultralight
\lfseries light
\sfseries semibold
\bfseries bold
\cfseries black
\xfseries extra black

\tenrm{T1 classT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clasT1 clas }

\end{document}

Please help me.

Thanks

share|improve this question
1  
Before posting your next question, please take a good look at meta.tex.stackexchange.com/q/1436, meta.tex.stackexchange.com/q/228, the faq and stackoverflow.com/questions/how-to-ask. Your questions tend to be of quite low quality, as the low votes and closings show. We're truly willing to help anybody with their (La- etc.)TeX problems, but we expect the questions to show that some effort has been made in a) trying to solve the problem, e.g. by some basic googling, and b) asking a clear and useful question. –  doncherry Sep 3 '11 at 23:07
add comment

1 Answer 1

up vote 6 down vote accepted

There are various problems with the code you have posted.

  1. You are using TeX primitives to choose fonts rather than the LaTeX commands provided by the fontspec package.

  2. If a particular font doesn't have different weights, then no amount of choosing them will cause the weights to appear. For example, Charis SIL comes only in Regular, Bold, Italic, and Bold Italic.

  3. Even when using the XeTeX commands as opposed to the fontspec commands, the "/" suffix to the font name must be in upper-case, not lower case, and (at least from the XeTeX documentation) there are only four possibilities: B, I, BI and IB (the latter two being identical).

So for other weights, I think you need to choose the font by name directly. Here's a version of your document using fontspec commands and Minion Pro, which has various weights (on my system). If you want to use e.g. bold with a font that doesn't have it, you can use the [AutoFakeBold] option when loading the font.

% !TEX TS-program = XeLaTeX

\documentclass{article} 
\usepackage{fontspec}
\setmainfont{Minion Pro}
\newfontfamily\semibold{Minion Pro Semibold}
\newfontfamily\condensed{Minion Pro Bold Cond}
\newfontfamily\regsemi[BoldFont={* Bold Cond}]{Minion Pro}
\newfontfamily\regitbold[BoldFont={* Bold Italic}]{Minion Pro}
\begin{document} 


{\semibold Some semibold text.}

{\condensed Some bold condensed.}

{\regsemi Regular with \textbf{Semibold} as the bold font.}

{Regular with \textbf{Bold} as the bold font. }

{\regitbold Regular with \textbf{Bold Italic} as the bold font.}
\end{document}

output of code

share|improve this answer
    
Your screenshot code slipped into the code block; I fixed that. Is the % !TEX TS-program = XeLaTeX any particular convention or a pointer for a particular editor or script? –  doncherry Sep 3 '11 at 22:57
1  
@doncherry It's TeXworks's and TeXShop's way of choosing the right compiler, similar to the TeX-engine variable of AUCTeX for Emacs. –  egreg Sep 3 '11 at 23:15
add comment

Your Answer

 
discard

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

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