4

I've read several threads about this, but none solves my problem. When I try to change font, it won't compile. Is there an other way to change font, that will still allow me to write stuff like: $\mu$ ?

Minimal working example:

\documentclass[10pt,twocolumn]{article} 
\usepackage[swedish,english]{babel} 
\usepackage[applemac]{inputenc} %Endast för mac. Om PC, ta bort.
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{appendix}
\setcounter{secnumdepth}{1}
\usepackage[a4paper, top=1.5cm, bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage{todonotes}
\usepackage[super]{nth}
\usepackage{sectsty}
\usepackage{csquotes} %Engelsk version.
\MakeOuterQuote{"}
\sectionfont{\fontsize{14}{1}\selectfont}
\subsectionfont{\noindent\fontsize{10}{1}\selectfont\normalfont\textit}
\setlength{\parindent}{0.5cm}
\setlength{\columnsep}{0.6cm}
\usepackage[MnSymbol]{mathspec}
\setallmainfonts{Times New Roman}
\newcommand{\hs}{\,\hspace{0.8mm}}
\usepackage{caption}
\DeclareCaptionFormat{myformat}{\fontsize{9}{1}\selectfont#1#2#3}
\captionsetup{format=myformat}
\begin{document}
This is a greek letter: $\pi$
\end{document}
17
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    – user31729
    May 29 '14 at 13:55
  • I also suggest to post a MWE (minimal working example): (meta.tex.stackexchange.com/q/228) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    May 29 '14 at 13:57
  • 2
    @KallePalm OK in that case please edit your question to have a full document from \documentclass to \end{document} and paste the exact error from the log "wont compile" is rather too vague to guess what is happening (my initial guess that you were using pdflatex was wrong:-) May 29 '14 at 14:08
  • 1
    @KallePalm XeLaTeX requires the file is saved as UTF-8; inputenc should not be loaded.
    – egreg
    May 29 '14 at 14:12
  • 1
    Ian, I missed adding the sectsty in the MWE
    – Kalle Palm
    May 29 '14 at 14:16
3

In the current (2014) LaTeX release your example generates

! Package inputenc Error: inputenc is not designed for xetex or luatex.
(inputenc)                only UTF-8 supported.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.165 \endinput

? 

If I delete the inputenc line and save the file in UTF-8 I get...

nothing, the document hangs (not what I expected:-)

adding \tracingall here:

 \tracingall$\pi$

and stopping it before it filled the disk with log

The basic problem is that mathspec makes use of active definition of " all over the place and for example \pi is defined as

\pi=macro:
->{"π}.

I had a quick look at defining " to what mathspec wants in math mode and csquotes wants in text mode, that's probably possible but seems a bit tricky. So not using csquotes active " seems a good idea if you want to use mathspec

mathspec is an old package really and pre-dates most of the development of Unicode math fonts, is there a reason not to use unicode-math ?

7
  • mathspec uses " for adjusting the spacing in mathmode; see tex.stackexchange.com/a/62457/4427
    – egreg
    May 29 '14 at 23:16
  • Problem is, if I don't use inputenc, I can't use swedish letters: å, ä, ö. They just become grey boxes.
    – Kalle Palm
    May 30 '14 at 14:23
  • @KallePalm No you must be doing something wrong: inputenc does not work with xetex and is not needed xetex is designed to use unicode fonts you can use Swedish, or Chinese or Greek, so long as your file is UTF-8 encoded and you are using suitable fonts (Times Roman should be fine for Swedish) it should all work. May 30 '14 at 14:49
  • Weird. I tried commenting out the inputenc-row and all swedish letters become boxes. This might make me look really silly, but maybe I'm not using Xetex? I thought I was.
    – Kalle Palm
    May 30 '14 at 15:49
  • @KallePalm do you need to use xetex? (or mathspec?) what features do you need over pdflatex (the most common format still) May 30 '14 at 16:03

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