This code can print \si{\us}  \RequirePackage{luatex85} \documentclass[border=1cm]{standalone} \usepackage{siunitx}  \begin{document} Time \si{\us} \end{document}     while this one doesn't print the desired output  \RequirePackage{luatex85} \documentclass[border=1cm]{standalone} \usepackage{mathtools} \usepackage[tuenc,no-math]{fontspec} \usepackage{unicode-math} \usepackage{siunitx}  \begin{document} Time \si{\us} \end{document}     So, what packages are responsible for such a flaw? Additionally, in what order should I load them?
104541
The Problem  I'm using unicode-math and the font TeX Gyre Pagella Math. Also, I use siunitx to denote my quantities. Unfortunately, the option \micro of siunitx doesn't get expanded to µ, but is dropped.  (The same behaviour can be observed when using mathspec in XeLaTeX)  Minimal working example  Compile with Xe/LuaLaTeX.  \documentclass{standalone} \usepackage{unicode-math} \setmathfont{TeX Gyre Pagella Math} \usepackage[mode = math]{siunitx} \begin{document} \SI{10}{\micro\m} \end{document}   Output        Expected output
59389
I'm trying to write a document that will contain characters in many different scripts (for which I am using fontspec and rendering with xelatex) and IPA symbols (for which I am using TIPA). Ordinarily, this works fine, however, I want to use slshape for my IPA symbols. If I take the manual's advice and use  \textipa{\slshape f@"nEtIks}   Or  \textipa{\textsl{f@"nEtIks}}   It fails with fontspec loaded. The document renders properly, but the IPA symbols appear upright. If I remove fontspec, then this works correctly, with the IPA symbols slanted. I tried getting fontspec to use tipasl12, but I could not find a way of allowing fontspec to use the font. However I named it, fontspec could not find the font.  This is the LaTeX I have which produces the correct IPA symbols, but they appear upright:  \documentclass[12pt,openany]{book} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{amsmath} \usepackage{amssymb} \usepackage{fontspec,xltxtra,xunicode} \newfontfamily{\AR}[Script=Arabic]{Scheherazade} \usepackage{tipa}  \begin{document}    \textipa{\slshape f@"nEtIks}  \end{document}   The following, however, works perfectly, but - obviously - would not allow me to use Arabic characters:  \documentclass[12pt,openany]{book} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{amsmath} \usepackage{amssymb} %\usepackage{fontspec,xltxtra,xunicode} %\newfontfamily{\AR}[Script=Arabic]{Scheherazade} \usepackage{tipa}  \begin{document}    \textipa{\slshape f@"nEtIks}  \end{document}
23985
I just don't seem to get it. So I come from the german speaking part of Switzerland and naturally I need ä ü ö a lot when I write german texts. So in LaTeX I have the option to go via  "a "u "o  which isn't really comfortable, or I can use an additional package. So now the confusion starts. I can use either  \usepackage[T1]{fontenc}  or  \usepackage[latin1]{inputenc}  So now if I create a new document and save it as a latin-1 encoded .tex file it seems it doesn't matter which option I chose they both work. Now why should I pick one over the other or use both? Which problems could occur (Do they occur if I use the same .tex file on another OS depending on which option I have chosen?)?  If I save the .tex encoded as lets say the mac os latin then the first option compiles but shows the wrong characters for the ä ü ö's. Is it then like latex maps the ä according to the latin1 to a character and since the document is encoded as something different than latin1 then gets encoded to something different again?  So if the last 2 paragraphs have been confusing (mainly because I'm confused) the main question is: What does fontenc what inputenc doesn't do and vice versa?
106510
When looking in books or at sample code, I always see \documentclass appearing first. Is that absolutely necessary?  I have created some test code which seems to compile fine:  \def\SetClass{article} \documentclass{\SetClass} \begin{document}     This is some text. \end{document}   Is there any problem with placing other items, such as \input, \usepackage, or such details before the \documentclass?
12257
I'm in the process of switching my LaTeX document from pdflatex to lualatex. Similar to  I would like to know, what are typical packages loaded with LuaLaTeX and which typical pdfLaTeX packages should be removed or replaced?  The following are the main difference I found so far:   Don't use inputenc, but instead save your plain files in utf-8 and add the following as the first line: % !Mode:: "TeX:UTF-8". Don't use font-packages but instead load fontspec with \setmainfont{FONT_NAME}, \setsansfont{FONT_NAME}, \setmonofont{FONT_NAME}. In order to make microtype work with fontspec, use the beta version of microtype (At least with TeX Live 2011). . hyperref should be loaded with the option unicode.   What other packages do you use? What about babel and textcomp? And are there some "killer-packages" that are only working with lualatex besides fontspec?
76424
In  I ended up with  \DeclareMathSymbol{:}{\mathpunct}{operators}{"3A}   But now I'm using the fontspec package which redefines : with \AtBeginDocument itself. So as my own definition comes before fontspec is loaded, even putting it in \AtBeginDocument won't help.  Is there a way to say “Execute this after fontspec has loaded!” or “Execute this at the very end of \AtBeginDocument!”?
62655
I also posts this here: . The problem is that I want to have the \period symbol (also range="002E does not work) from the mainfont, but when I run this:  %!TEX TS-program = lualatex \documentclass{standalone} % \usepackage[math-style=ISO]{unicode-math} % \setmainfont{MinionPro-Regular} % \setmathfont{LatinModernMath-Regular} \setmathfont[range=\period]{MinionPro-Regular} \setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{MinionPro-Regular} \setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold} \setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It} \setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt}  \begin{document}     $\bigl(x^2+5\bigr).$ \end{document}   I get the following result:    Are there any ideas to solve this problem? Thanks for help.  I may think the problem lies in the \right.- and \left.-delimiters, because you won't get the incorrect result if you use \left and \right instead of \bigl( and \bigr). It seems as if range=\period makes them visible.  Is there a possibility to fix this?
105721
I want to prevent processing rest part of a package in case if it is loaded not from lualatex. For some reason I cannot load ifluatex package, so I borrowed definition of \ifluatex from that package and invented the following chunk of code:  \expandafter\ifx\csname luatexversion\endcsname\relax % = not \inluatex   %\typeout{^^J********************** not LuaTeX^^J}   \PackageError{babel}{     ^^J\space\space * Option russianu is intended for LuaTeX only.              ^^J\space\space * Option russian  is used instead.                     }   \relax   \input{russianb.ldf}     \let\@next@action\endinput \else   %\typein{^^J********************** LuaTeX^^J}   \let\@next@action\relax \fi \@next@action   It seemed to work but Is there a better solution. In particular, it is desirable to avoid introduction of \@next@action because it is used the only time.  Just to explain: my goal is to hack babel with option russian to make it working painlessly with LuaLaTeX without any additional hacks (as described, eg, in  and )
49818
MWE: greatly trimmed from a large document; XeLaTeX; full TeXLive2012 completely up-to-date:  \documentclass{memoir} \usepackage{fixltx2e} \usepackage{amsmath} \usepackage{mathspec} \usepackage{glossaries} \usepackage{lipsum} \begin{document} \lipsum[1] \end{document}   Fails with "! Package mathspec Error: 'amsmath' must be loaded earlier than `mathspec'."  Now, if I eliminate glossaries, or move it above mathspec in the file, things work. But it isn't very convenient to have to sort ones packages whenever anything gets a new dependency. And in any case, I do load amsmath before mathspec, don't I?  Really puzzled by this one. Any illumination would be most welcome.  (BTW, not strictly MWE, as it also fails with article.
6628
I was surprised to find that standalone package can not compile a document with an equation:  \documentclass{standalone} \begin{document} \begin{equation} % not working! F(V, T) = E(V) + D(T) \end{equation} \end{document}   Is there an option or some workaround that allows this? The current error is something like:   ! Missing $ inserted.   in line 4. (The idea of course is that the including (main) document can just \input the standalone without knowing if is going to be an equation or something else)
68973
MWE:  \documentclass{article}  \usepackage{bm}  \begin{document} $$x(t), \bf{x}(t), \bf{x(t)}$$ \end{document}   Result:    Question:  Why are the second and third x(t) typeset the same? In the second  expression, it was asked to apply \bf to only x.  EDIT:  I had not payed attention to it when asking the question, but I would like to have a bold and italic x.
120516
I'm having troubles with LuaLaTeX and the listings package: the former doesn't seem to accept me performing \lstinputlisting on a filename that doesn't have an extension.  Minimal example:  Makefile:  hello: hello.c     cc -o hello hello.c   test.tex:  \documentclass[a4paper]{article} \usepackage{listings} \begin{document} \lstinputlisting{Makefile} \end{document}   pdfLaTeX is successful, LuaLaTeX displays the following error:  ! Package Listings Error: File `Makefile(.tex)' not found.  Type X to quit or &lt;RETURN&gt; to proceed, or enter new name. (Default extension: tex)  Enter file name:   I'm using the freshest versions from TeXLive 2012 (pdfTeX 3.1415926-2.4-1.40.13, LuaTeX beta-0.70.2-2012052410).  What's the trouble?
106088
I got a weird problem with the  package and the  package. Let's see the MWE first.  %!TEX program = xelatex \documentclass{article} \usepackage{graphicx} \usepackage{fontspec} \setmainfont{Times New Roman} \newfontfamily\test[AutoFakeBold = 5]{Times New Roman} \begin{document} \test Test \textbf{Bold Test}  \includegraphics[scale = 0.1]{photo}  Words that shouldn't be bolded. Even if \textmd{textmd-ed}. \end{document}         In the preamble, I loaded the graphicx package and the fontspec package, then I set Times New Roman as the default font of the text as well as the font of the test command. In the definition of \test, I enabled AutoFakeBold. In the document body, between the two chains of text, I inserted a photo with the \includegraphics command.  It's a normal manuscript, except that AutoFakeBold was set to 5 to make the abnormal output more remarkable. After the compilation, however, the later line of text presented an unexpected output. That is, this line of text shouldn't be bolded.  Even more surprising is that, if one   cancel the option passed to \includegraphics, or put some more text after \textbf{},   the problem will go away.  I suspect the problem lies in the FakeBold mechanism of the fontspec package and/or the key-val mechanism of the graphicx package, but unfortunately, I don't read LaTeX3 codes, so I cannot locate it.  Maybe an issue should be posted to fontspec or graphicx, but before that, could someone provide me a quick fix to this problem?    EDIT 2015/01/05  Thanks to the help of qingkuan@bbs.ctex.org, it seems to be a bug of XeTeX. See the new MWE.  % !TeX program = xetex  \font\x="[cmunrm.otf]" \font\bx="[cmunrm.otf]:embolden=5;"  \x Test {\bx Bold Test} \XeTeXpicfile "example-image.png"  width 1cm\relax Words that shouldn't be bolded.   \tracingoutput=1 \showboxbreadth=\maxdimen \showboxdepth=\maxdimen  \bye         I made a ticket on  and hope this will be fixed soon.
32995
MWE needs to be compiled with LuaTeX to reproduce the problem:  \documentclass[11pt]{report}% \usepackage{amsmath,mathtools} \usepackage{breqn}                          \begin{document} $J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO}$ \[ J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO} \] \end{document}   Gives (no compile error or any warning) the following strange output    I have to use breqn package. If I remove it, then I get the expected output    Is there a way to work around this, so I can use breqn and get correct output?  TL 2015. filelist: (compiled with lualatex)  This is LuaTeX, Version beta-0.80.0.1 (TeX Live 2015) (rev 5863)   *File List*   report.cls    2014/09/29 v1.4h Standard LaTeX document class   size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)  amsmath.sty    2013/01/14 v2.14 AMS math features  amstext.sty    2000/06/29 v2.01   amsgen.sty    1999/11/30 v2.0   amsbsy.sty    1999/11/29 v1.2d   amsopn.sty    1999/12/14 v2.01 operator names mathtools.sty    2015/11/12 v1.18 mathematical typesetting tools   keyval.sty    2014/10/28 v1.15 key=value parser (DPC)     calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)  mhsetup.sty    2010/01/21 v1.2a programming setup (MH)    breqn.sty    2015/08/11 v0.98d Breaking equations    expl3.sty    2015/12/20 v6326 L3 programming layer (loader)  expl3-code.tex    2015/12/20 v6326 L3 programming layer  l3pdfmode.def    2015/11/11 v6250 L3 Experimental driver: PDF mode flexisym.sty    2015/08/11 v0.98d Make math characters macros   cmbase.sym    2007/12/19 v0.92 mathstyle.sty    2015/08/11 v0.98d Tracking mathstyle implicitly graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)     trig.sty    1999/03/16 v1.09 sin cos tan (DPC) graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live   pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)  ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO) supp-pdf.mkii pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO) ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)    ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO) luatex-loader.sty    2010/03/09 v0.4 Lua module loader (HO) epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf   grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO) kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO) kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO) kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO) etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live  ***********   Update  I found another case of duplication when using breqn, which does not involve \text at all. But the solution provided below also fixes this issue. I am adding this second case here for reference just in case it might be useful. Here is MWE  \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath,mathtools} \usepackage{breqn} \begin{document} \[ \underset{\mathbf{S}} {\operatorname{arg\,min}}      \sum_{i=1}^{k} \sum_{\mathbf x \in S_i}       \left\| \mathbf x - \boldsymbol\mu_i \right\|^2  \] \end{document}   The output is    After adding the patch in the answer below the correct output is now given, which is
76313
It sounds simple but I have a really heavy issue with the "ö ü ä ß" in Latex. I use a template from my university, i have a mac and i use TeXShop if that matters.  Within there is a packages.tex with the following  (...)  \usepackage[T1]{fontenc}            % Standard package for selecting font encodings \usepackage{lmodern}                    % alternative Computer Modern-fonts for computer screens \usepackage{textcomp}                   % LaTeX support for the Text Companion fonts (...)   Also I have a thesis.tex with  (...) \usepackage[utf8]{inputenc}     % Accept different input encodings \usepackage{ifthen}                     % Conditional commands in LaTeX documents (...)   Now I tried to use  \usepackage[ngerman]{babel}   as well as  \usepackage[applemac]{inputenc}   but unfortunately it doesn't work. The best case was another error "hyphenation flashed" or something.   \documentclass[     fontsize=12pt,     a4paper,     portrait,                                    oneside,                                         openright,                                   final,                                               titlepage,                                       onecolumn,                                       bibliography=totoc,     numbers=noenddot                     ]{scrbook} \usepackage[T1]{fontenc}         \usepackage{lmodern}     \usepackage[utf8]{inputenc}      \usepackage{ifthen}          \begin{document} öä \end{document}   Now I replaced  \usepackage[utf8]{inputenc}        with  \usepackage[applemac]{inputenc}   in the minimal working example above and it worked BUT in the other document it still doesn't work :( There it gives me the error (see picture)
121110
I am very new to LaTeX and I am writing my thesis. In a chapter, I want to show my codes, which are in Mathematica.   I use the listings package as follows:  \documentclass{article}   \usepackage{listings}   \begin{document}   \lstset{language=Mathematica}    \begin{lstlisting}   Do[i^j,{i,1,10},{j,1,10}]   \end{lstlisting}    \end{document}   However, the output is much different to what the code looks like in the Mathematica IDE (even if I use other languages in \lstset{language=&lt;name&gt;}):    I read some questions on the site but, in some of them, the font or color of the codes were not the same. Could you please help me to display something like the picture below in LaTeX?  If it is important, I am using the BiDi package.
118876
I wanted to make a command that outputs a number in math mode. This is how my file looks like:  \documentclass{scrartcl}  %\usepackage{epsdice} %\newcommand{dice}[1]{\epsdice{#1}}  \newcommand{dice}[1]{\ensuremath{#1}}  \begin{document} Lorem ipsum... \end{document}   But when I compile this with XeTeX, I always get this error:  ! LaTeX Error: Missing \begin{document}.  See the LaTeX manual or LaTeX Companion for explanation. Type  H &lt;return&gt;  for immediate help.  ...                                                l.13 \newcommand{dice}[1]{\ensuremath{#1}}   I have not that much experience with TeX, I think the solution is quite easy.