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.

Sorry I have minimal knowledge of how font families work in TeX. After trying to read the fontspec documentation I get more and more confused. I am trying to get as many variants of Latin Modern Roman working as I can, especially the variants of unslanted roman, oblique small caps. Foe example I do not know how to get small caps oblique to be used when itshape and scshape are both in effect.

I originally wanted \textup to have the Unslanted variant of the font but doing UprightFont = Latin Modern Roman Unslanted would change all normal font to that as well. I thought the whole point of \textup and \textrm being separate commands is allow distinction with upshape? Anyhow because of this I am defining \textun for the unslanted variant.

Is it also possible to have fake bold with small caps by using, say, weight in fontspec such that I can put \textsc{Abc} in section headings (i.e. such that it works with \bfseries)?

\documentclass[a4paper,10pt,english,draft]{article}
% Additional Options
\usepackage[log-declarations=false]{xparse}
\usepackage[quiet]{fontspec}
%fontspec options:
\setmainfont[Ligatures=TeX,SmallCapsFont={* Caps}, SlantedFont={* Slanted}]{Latin Modern Roman}
\newfontface\textun{lmromanunsl10-regular.otf} 
%I cannot use \newfontface\textun{Latin Modern Roman Unslanted} for some reason...
\begin{document}
    Latin Modern Roman normal text \newline  
    \textit{Latin Modern Roman italic text} \newline  
    \textsl{Latin Modern Roman Slanted} \newline  
    \textun{Latin Modern Roman Unslanted} \newline
    \textsc{Latin Modern Roman Caps} \newline  
    \emph{\textsc{Latin Modern Roman Oblique small caps?}}
\end{document}
share|improve this question
    
Can you give a source to the fonts? I can't find any SmallCaps variant in my set. –  Qrrbrbirlbel Oct 25 '12 at 16:41
    
@Qrrbrbirlbel You need the OTF version from here: gust.org.pl/projects/e-foundry/latin-modern –  Mobius Pizza Oct 25 '12 at 16:45
add comment

1 Answer

up vote 5 down vote accepted

Your original \textun acted as an switch (like \itshape) so I redefined \textun as

\newfontface\unshape[]{Latin Modern Roman Unslanted} 
\newcommand\textun[1]{{\unshape #1}}

\textrm, \textup and/or \textun

You easily could re-defined \textrm and \textup with

\renewcommand\textup[1]{{\unshape #1}} % see section "Code" for \unshape
\renewcommand\textrm[1]{{\unshape #1}}
normal \textup{unslanted} normal \textup{unslanted}

which gives you
rm and up as un

While that does work it is not a good idea. \textrm and \textup are well implemented macros. Who knows which package you might break?

Besides, \textrm and \textup aren't the same, for LaTeX applies:

  • rm (roman) is a family specifier (“Serifs”). Families are (generally) roman/serif/antiqua, sans-serif/grotesque and typewriter.
  • up is a shape specifier (“Slope”). Other shapes are: italics, oblique/slanted/sloped, Sᴍᴀʟʟ Cᴀᴘꜱ
  • And then there are series (“Weight”): light, medium, semi-bold, bold, heavy, … (names and definitions may vary). bf stands for boldface.

Code (Example)

{\sffamily sans-serif family \textrm{roman family} sf \textup{up shape} sf} \par
{\itshape italics \textrm{roman family} it \textup{up shape} it}

Output (Example)

rm and up

FakeBold and SmallCaps

Borrowing from sdaau's answer the OP himself has found the following map-workaround:

Code (FakeBold SmallCaps)

\fontspec[
    FakeBold=4,
    SmallCapsFont={Latin Modern Roman Caps}
    ]{Latin Modern Roman}
\DeclareFontShape{EU1}{LatinModernRoman(0)}{bx}{sc}{<->ssub * LatinModernRoman(1)/m/sc}{}

Font sizes?

The following code shows these fonts included in the PDF:

  • 5: Regular
  • 7: Regular, Italic
  • 8: Regular, Italic, Slant
  • 9: Regular, Italic, Slant
  • 10: Regular (+Caps), Italic, Oblique Caps, Slant, Unsl
  • 12: Regular, Italic, Slant
  • 17: Regular, Slant

Code

\documentclass[a4paper,10pt,draft]{article}
% Additional Options
\usepackage[landscape]{geometry}
\usepackage{fontspec}
%fontspec options:
\setmainfont[
    Ligatures=TeX,
    SmallCapsFont={Latin Modern Roman Caps},
    SlantedFont={* Slanted},
    ItalicFeatures  = {
        SmallCapsFont = {LMRomanCaps10-Oblique}
    },
    ]{Latin Modern Roman}

\newfontface\unshape[]{Latin Modern Roman Unslanted} 
\newcommand\textun[1]{{\unshape #1}}

\fontspec[
    FakeBold=4,
    SmallCapsFont={Latin Modern Roman Caps}
    ]{Latin Modern Roman}
\DeclareFontShape{EU1}{LatinModernRoman(0)}{bx}{sc}{<->ssub * LatinModernRoman(1)/m/sc}{}

\def\testtext{%
    Latin Modern Roman normal text \par
    \textit{Latin Modern Roman italic text} \par
    \textsl{Latin Modern Roman Slanted} \par
    {\textun{Latin Modern Roman Unslanted}} \par
    \textsc{Latin Modern Roman Caps} \par
    \emph{\textsc{Latin Modern Roman Oblique small caps?}} \par
    {\bfseries\scshape Latin Modern Roman Caps FakeBold}\par
    \null\par
}
\begin{document}
{\tiny\testtext}
{\scriptsize\testtext}
{\footnotesize\testtext}
{\small\testtext}
\testtext
{\large\testtext}
{\Large\testtext}
{\LARGE\testtext}
{\huge\testtext}
{\Huge\testtext}
\end{document}

Output (normal size)

normal size output


Yes there are \mdshape and \textmd.

share|improve this answer
    
Thanks, the problem with using file names specifically the optical sizes doesn't scale automatically (Sec 8.6 of the fontspec manual). Let me try without using the file names explicitly –  Mobius Pizza Oct 25 '12 at 16:58
    
I tried nesting BoldFeatures = {SmallCapsFeatures={AutoFakeBold=4,FakeBold=4}} but it failed to produce any results for \bfseries\scshape :( –  Mobius Pizza Oct 25 '12 at 18:01
    
@MobiusPizza Something like another answer might help you here, but I couldn't get it to work with LMR. –  Qrrbrbirlbel Oct 25 '12 at 18:34
1  
Thanks I was looking at it too. I have got it to work now, edited the code. Great answer by the way and thanks. –  Mobius Pizza Oct 25 '12 at 18:49
    
@MobiusPizza Glad I could clear some things up. And good catch with (Auto)FakeBold! –  Qrrbrbirlbel Oct 25 '12 at 19:13
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.