19
\documentclass{minimal}

\usepackage[paperheight = 140mm,% comprimento 
            paperwidth  = 200mm,% altura
            margin      = 10mm  % tamanho da margem
            ]{geometry}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{xcolor}

\setmainfont[Color=brown]{Tangerine}

\begin{document}
    Normal pleasure of your company is requested
\end{document}

I'm making a wedding invitation and I'm not sure how do it using LuaLaTeX.

I want to set, in \setmainfont, the default color and size but I don't know how. I'm able to set the color, as in the example, but not the size at the same time. \setmainfont[SizeFeatures={Size=30}]{Tangerine} sets the size, but I don't know how put it together. Is it possible?

Furthermore, how do I change the font size in the middle of the document? I tried \Huge but got an error.

  • 1
    You should not use fontenc and fontspec with LuaLaTeX; fontspec is enough. – Martin Schröder Feb 28 '12 at 19:39
  • @Martin: Loading fontenc doesn't do any harm here and fontspec loads it too. It is quite possible and sometimes even sensible to load fontenc more than once with different options to load definitions for various encoding (like you can load babel with more than one language). It is only important that like with babel the last option used is the active encoding at the start of the document, so fontspec (which activates encoding EU2) should at best be loaded after \usepackage[T1]{fontenc}. – Ulrike Fischer Feb 29 '12 at 10:42
31

\Huge did not work because you used the minimal document class, which does not provide any font size commands. Use the usual article instead.

You shouldn't also need to set font size with fontspec, too. Use any of these options:

  • To set a default font size document-wise, pass one of the options 10pt, 11pt or 12pt to the document class.
  • Use the usual font size commands (\small, \normalsize, \large, etc.).
  • If none of the above have the size you need, select it manually with \fontsize{<size>}{<leading>}. A \selectfont command has to follow immediately after.

The two latter options also can be used document-wise: just put them right after \begin{document} outside any groups.

To sum up, an example document:

\documentclass[10pt]{article}

\usepackage{fontspec}
\usepackage{xcolor}

\setmainfont[Color=brown]{Linux Libertine}

\begin{document}

Lorem {\Huge ipsum} dolor {\fontsize{14pt}{16pt}\selectfont sit} amet.

\end{document}

enter image description here

  • Many thanks. Your answer resolved my problem. – André Andrade Feb 28 '12 at 14:06
  • What are the first and second numbers? {\fontsize{14pt}{16pt}\selectfont sit} – skan Mar 13 at 16:51
17

The option SizeFeatures is not meant to set a size. It should be used to set features which should be activated/used only for some font sizes:

\documentclass{article}

\usepackage{fontspec}
\usepackage{xcolor}

\setmainfont[SizeFeatures={{Size=-11,Color=red},
                           {Size=11-30,Color=blue},
                           {Size=30-,Color=green}}]{Arial}
\begin{document}

normal red text 
\large larger blue text 
\fontsize{30pt}{30pt}\selectfont very large green Text
\end{document}

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.