## LaTeX forum ⇒ Texmaker and TeXstudio ⇒ XeLaTeX as Typesetting Engine

Information and discussion about Texmaker, an integrated LaTeX environment for several platforms, and the related TeXstudio
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

### XeLaTeX as Typesetting Engine

I am utterly new to LaTeX and Window 7 seems like an extremely difficult place to learn it as well. I'm trying to use TeXmaker to at least first load an example of a curriculum vitae I found online.

But when I try to load it I get a "fatal fontspec error."

Looking into this, I realized that it's because I need to first build with XeLaTeX (before I click "View PDF")

I tried just selecting XeLaTeX from the drop down menu, and I also tried a web solution involving custom editing the function in TeXmaker options. Both of these did not correct the issue - I get the same error.

When I installed MiKTeX, I clicked "yes" to install missing packages.

I'm assuming this has to be a fairly common error? What can I do to solve it? Very distressing, as I cannot even load a sample LaTeX, let alone start learning it!

Tags:

Johannes_B
Site Moderator
Posts: 4116
Joined: Thu Nov 01, 2012 4:08 pm
Hi,

in order to help you some additional information would be very useful. For example posting a Minimal working example helps to spot a problem. Follow the link to see how to make one. A link to the CV template could also be useful.

Please test the following code, does it work?
\documentclass{scrartcl}\usepackage{fontspec} \begin{document}Hello monday\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am
Thanks for the assistance.

As it turns out, despite being an ancient Windows user, amongst my many machines I count a MacBook. I installed all the MacTeX stuff on there, with TeXMaker included, and it worked in XeLaTeX...

Obviously this is sort of a terrible solution (I failed in Windows, but I got it to work in Mac), for now I'm just going to go with it, as I need to get this CV done in Latex stat.

1. I did have another related question though - How do I know which fonts are included/usable in XeLaTeX? I've looked online for a 'list' of the fonts AND their syntax (i.e. the name you use in the code for the font), but I've been strangely unable to find one.

I'm obviously not 'coding' LaTeX at this stage, so I'm just modifying a template for my uses...

For example, I replaced everywhere I saw font references in the template with \setmainfont{Arial}... and that happened to compile and display correctly.

I then tried
\setmainfont{Book Antiqua}

and that did NOT work for some reason (I've read XeLaTeX uses system fonts).
--
SO - basically I'm wondering - how do I KNOW the 'syntax' to use for a font, how do I know the font is included or not, AND where do I find a list of the fonts themselves?

Thanks!
Last edited by cgnieder on Wed Jul 17, 2013 2:20 pm, edited 1 time in total.

InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am
I forgot - this is the link/template I am trying to use...

http://aleplasmati.comuv.com/?p=10I

Originally I wanted to use THIS one... but I was unable to figure out how to INDENT a line (I wanted the academic degree obtained indented UNDER the name of the university/college, but couldn't get it to work with this one...)

http://linux.dsplabs.com.au/resume-writ ... -text-p54/

InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am
I was mistaken - when I switched to Mac, I am now using TexShop apparently (it comes with the MacTex installation) - so many editors I've been trying I got confused - I assume my questions above are editor agnostic though?

Johannes_B
Site Moderator
Posts: 4116
Joined: Thu Nov 01, 2012 4:08 pm
Have a look at the fontspec documentation to see how fonts have to be chosen with XeLaTeX.

Concerning the editor: It doesn't matter which editor you are using, the distribution (MacTeX) is important.

To tell something about the line indentation, you should post a minimal working example.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

cgnieder
Site Moderator
Posts: 1990
Joined: Sat Apr 16, 2011 7:27 pm
InquisitorMo wrote:[...] For example, I replaced everywhere I saw font references in the template with \setmainfont{Arial}... and that happened to compile and display correctly.

I then tried
\setmainfont{Book Antiqua}

and that did NOT work for some reason (I've read XeLaTeX uses system fonts). [...]

XeLaTeX does use system fonts. So supposing you have indeed Book Antiqua installed on your system fontspec should be able to load it.

fontspec manual wrote:Fonts known to LuaTeX or XeTeX may be loaded by their standard names as you’d speak them out loud, such as Times New Roman or Adobe Garamond. ‘Known to’ in this case generally means ‘exists in a standard fonts location’ such as ̃/Library/Fonts on Mac OS X,
or C:\Windows\Fonts on Windows.

The simplest example might be something like
\fontspec[ ... ]{Cambria}

in which the bold and italic fonts will be found automatically (if they exist) and are immediately accessible with the usual \textit and \textbf commands.
TODO: add explanation for how to find out what the ‘font name’ is.

You can guess by the TODO that font names are not always as intuitively found as one would wish. Maybe the font has another name on your machine? You could also try to load the font by filename:

fontspec manual wrote:XeTeX and LuaTeX also allow fonts to be loaded by file name instead of font name. When you have a very large collection of fonts, you will sometimes not wish to have them all installed in your system’s font directories. In this case, it is more convenient to load them from a different location on your disk. This technique is also necessary in XeTeX when loading OpenType fonts that are present within your TeX distribution, such as /usr/local/texlive/2013/texmf-dist/fonts/opentype/public. Fonts in such locations are visible to XeTeX but cannot be loaded by font name, only file name; LuaTeX does not have this restriction.

When selecting fonts by file name, any font that can be found in the default search paths may be used directly (including in the current directory) without having to explicitly define the location of the font file on disk.

XeTeX & Mac users only: Note that XeTeX can only select fonts in this way with the xdvipdfmx driver, but XeTeX with the xdv2pdf driver can only select system-installed fonts by font name and not file name. The xdvipdfmx driver is default for XeTeX, so this is only a problem if you wish to explicitly use the xdv2pdf driver.

Fonts selected by filename must include bold and italic variants explicitly.
\fontspec   [ BoldFont = texgyrepagella-bold.otf ,     ItalicFont = texgyrepagella-italic.otf ,     BoldItalicFont = texgyrepagella-bolditalic.otf ]   {texgyrepagella-regular.otf}

fontspec knows that the font is to be selected by file name by the presence of the ‘.otf’
extension. An alternative is to specify the extension separately, as shown following:
\fontspec   [ Extension = .otf ,     BoldFont = texgyrepagella-bold ,     ... ]   {texgyrepagella-regular}

Regards
site moderator & package author

InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am
Wow thank you all for the dedicated help!

I went to my system fonts application (it's a mac, I forget what it's called at the moment, FontBook, I think?) and tested the fonts out of there - the 3 I tried seem to work, so I'll probably just use one of those.

I do find it a bit odd that the filename vs fontname syntax isn't made more transparent - how do (even people who know Latex) people remember/know which font they want to use, or test new ones?

As for adding a 'tab' to items, I realized I can just use the horizontal space (I know that seems uber-trivial, but I also just learned how to even compile the document, so...).

1. To get my tab, I used: \hspace{0.5in}

on the lines where I wanted it.

I'm not sure if that will create any kinds of formatting issues (since apparently there are much more elegant (sort of Object-oriented) ways of doing this rather than line by line, by building a custom class, etc., but since it renders the way I want for now, it's ok.

I do really like Latex, but I definitely feel like it needs much better documentation; even a few tutorials that come onboard would be helpful. I already know that I'm going to have more questions as I work with it, and it does feel leech-y relying on others' kindness in the forums!

Thanks!

Johannes_B
Site Moderator
Posts: 4116
Joined: Thu Nov 01, 2012 4:08 pm
LaTeX and related things are, in general, documented quite good.
THe easiest way to find a documentation is to open a terminal and type
texdoc <NameOfThePackageOrClass>
and to confirm with enter.

For you as a starter I recommend lshort and latex2e. LaTeX for complete novices is an ebook by Nicola Talbot, also a forum member. The LaTeX Beginner's Guide is a book written by our site admin.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.