# MonTeX (mls, manju, mongolian) with Latin script with diacritics

I am using the montex package to type text in Manchu (manju). In my documents, I also use Latin script with diacritics. When I load montex, these diacritics no longer appear, and when characters with diacritics reach 100, compilation fails altogether because of too many error. The montex documentation lists several encodings for Input and Output, the former including utf-8 (pp. 19-22). As a non-programmer, I don't quite understand this, but it seems to me that none of the encodings listed in Table 4.1. "MonTeX Input Encodings" has one that can handle all the diacritics that I need. Does this mean that MonTeX is in fact incompatible with full unicode?

Working minimal example without montex:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
yǐ mǎn zhōng wèn wén\\ %Latin texts with diacritics in Roman and Italics
\emph{yǐ mǎn zhōng wèn wén}
\end{document}


This looks good:

If I also load MonTeX and write some Manchu, it does not work:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
\bithe{manju gisun}\\ %Typing Manchu
yǐ mǎn zhōng wèn wén\\
\emph{yǐ mǎn zhōng wèn wén}
\end{document}


The result:

In this file, the italicization has disappeared as well.

Looking through the list of encodings in the MonTeX manual, I find---perhaps I'm wrong?---that the best encoding is english as document language, and mls as encoding. But adding these options to

\usepackage[english,mls]{mls}


doesn't change the output.

The above is compiled with XeLaTeX but I've also compiled the same file with LuaLateX with the same result

Does anyone know what I should do to resolve this?

-
Looking at mls.sty, I see that the package fontenc an inputenc are required, which, afaik, clash with fontspec. Removing \usepackage{fontspec} and \setmainfont{Linux Libertine O then compiling with xelatex or lualatex work in my machine. But I am not really that sure what is happening here. :-) –  hpesoj626 Jan 29 '13 at 3:51
@hpesoj626 Hmm it doesn't solve it for me, the problem remains the same. Also, I do need some way to choose between fonts (in real documents, there will be CJK, italics, small caps and all sorts of stuff included...) –  Mårten Jan 29 '13 at 4:00
Can't you use fontspec for font selection (italics etc.)? And then you can use CJK or whatever for CJK fonts, I believe. The point is that inputenc isn't suitable if you are using XeLateX and fontenc probably isn't unless you know why you need it. –  cfr Mar 16 at 2:17
Load mls before fontspec. It is still wrong but the output is better and you get more meaningful error messages. –  cfr Mar 16 at 2:22

Make a copy of mls.sty. Name it mls-hacked.sty. Apply the following patch.

--- mls-hacked.sty      2010-04-09 19:28:51.000000000 +0100
+++ mls-hacked.sty      2014-03-16 02:32:39.086050752 +0000
@@ -11,7 +11,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -------------------     identification     -------------------
%
-\newcommand{\VersionDate}{2010/04/01}% 2002/07/01 with modified language name
+\newcommand{\VersionDate}{2014/03/16}% 2002/07/01 with modified language name
\newcommand{\ImplementationLevel}{IVu}%
\newcommand{\VersionKirill}{04}%
\newcommand{\VersionMongol}{092}%
@@ -19,7 +19,8 @@
\ImplementationLevel.\VersionKirill.\VersionMongol}%
%
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{mls}[2010/04/01 IVu.04.092 Mongolian for LaTeX2e]%
+\ProvidesPackage{mls-hacked}[2014/03/16 IVu.04.092 Mongolian for LaTeX2e Hacked to remove inputenc]%
+\PackageWarning{mls-hacked}{This is NOT the official version of mls.sty. It will almost certainly break things badly. It will complain slightly less when used with XeLaTeX, however.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -------------------      initial code      -------------------
@@ -337,55 +338,6 @@
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% -------- Loading of various codepage definitions -------------
-%
-% Input encodings supplied by MonTeX
-%
-\DeclareOption{mls}{\PassOptionsToPackage{cpmls}{inputenc}}%
-\DeclareOption{ncc}{\PassOptionsToPackage{cpncc}{inputenc}}%
-\DeclareOption{mos}{\PassOptionsToPackage{cpmos}{inputenc}}%
-\DeclareOption{mnk}{\PassOptionsToPackage{cpmnk}{inputenc}}%
-\DeclareOption{dbk}{\PassOptionsToPackage{cpdbk}{inputenc}}%
-\DeclareOption{ibmrus}{\PassOptionsToPackage{cpibmrus}{inputenc}}%
-\DeclareOption{koi}{\PassOptionsToPackage{cpkoi}{inputenc}}%
-\DeclareOption{ctt}{\PassOptionsToPackage{cpctt}{inputenc}}%
-%
-% Initial Unicode Mongolian utf-8 support. Experimental
-%
-\DeclareOption{utf8}{\PassOptionsToPackage{utf8}{inputenc}}%
-%
-% Input encodings supplied by standard installations
-%
-\DeclareOption{1250}{\PassOptionsToPackage{cp1250}{inputenc}}%
-\DeclareOption{1252}{\PassOptionsToPackage{cp1252}{inputenc}}%
-\DeclareOption{437de}{\PassOptionsToPackage{cp437de}{inputenc}}%
-\DeclareOption{437}{\PassOptionsToPackage{cp437}{inputenc}}%
-\DeclareOption{850}{\PassOptionsToPackage{cp850}{inputenc}}%
-\DeclareOption{852}{\PassOptionsToPackage{cp852}{inputenc}}%
-\DeclareOption{865}{\PassOptionsToPackage{cp865}{inputenc}}%
-\DeclareOption{cp1250}{\PassOptionsToPackage{cp1250}{inputenc}}%
-\DeclareOption{cp1252}{\PassOptionsToPackage{cp1252}{inputenc}}%
-\DeclareOption{cp437de}{\PassOptionsToPackage{cp437de}{inputenc}}%
-\DeclareOption{cp437}{\PassOptionsToPackage{cp437}{inputenc}}%
-\DeclareOption{cp850}{\PassOptionsToPackage{cp850}{inputenc}}%
-\DeclareOption{cp852}{\PassOptionsToPackage{cp852}{inputenc}}%
-\DeclareOption{cp865}{\PassOptionsToPackage{cp865}{inputenc}}%
-\DeclareOption{ansinew}{\PassOptionsToPackage{ansinew}{inputenc}}%
-\DeclareOption{applemac}{\PassOptionsToPackage{applemac}{inputenc}}%
-\DeclareOption{ascii}{\PassOptionsToPackage{ascii}{inputenc}}%
-\DeclareOption{atari}{\PassOptionsToPackage{atari}{inputenc}}%
-\DeclareOption{decmulti}{\PassOptionsToPackage{decmulti}{inputenc}}%
-\DeclareOption{isolatin}{\PassOptionsToPackage{isolatin}{inputenc}}%
-\DeclareOption{latin1}{\PassOptionsToPackage{latin1}{inputenc}}%
-\DeclareOption{latin2}{\PassOptionsToPackage{latin2}{inputenc}}%
-\DeclareOption{latin3}{\PassOptionsToPackage{latin3}{inputenc}}%
-\DeclareOption{latin5}{\PassOptionsToPackage{latin5}{inputenc}}%
-\DeclareOption{mac}{\PassOptionsToPackage{mac}{inputenc}}%
-\DeclareOption{next}{\PassOptionsToPackage{next}{inputenc}}%
-\DeclareOption{pc850}{\PassOptionsToPackage{pc850}{inputenc}}%
-\DeclareOption{roman8}{\PassOptionsToPackage{roman8}{inputenc}}%
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -------------------  execution of options  -------------------
%
\ProcessOptions
@@ -415,8 +367,6 @@
\DeclareFontSubstitution{LMO}{bcghs}{m}{n}%
\fi
%
-\RequirePackage{inputenc}%
-%
% PostScript detection; necessary for user-friendly
% execution of vertical capsules
%


will produce:

\documentclass{article}
\usepackage{mls-hacked}% Note that the order is crucial - this must be loaded before fontspec
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
\bithe{manju gisun}\\ %Typing Manchu
yǐ mǎn zhōng wèn wén\\
\emph{yǐ mǎn zhōng wèn wén}
\end{document}


Note that you can get the same output with mls.sty but it will complain a great deal about loading inputenc because this should not be loaded with XeLaTeX which assumes utf8 input.

-
does applying the patch means copying and pasting that contents into the end of the .sty file? or replacing the contents of the .sty with that contents? –  Mårten Mar 16 at 3:17
@Mårten Which OS are you on? On Linux or OS X, you would just save that as a file, patch, in the same directory as mls-hacked.sty (i.e. the copy of mls.sty). Then you would just say patch <patch. I don't know how you apply patches on Windows, though. –  cfr Mar 16 at 3:24
If necessary, you can apply the changes by hand. The first two lines just give information about which file is to be modified. The lines which start with - are deleted. The lines which start with + are added. The lines which start with @ specify locations in the file to help patch identify which lines to modify. The remaining lines provide context which also help patch to figure out which lines to modify. So you can basically find the lines in the file which I've deleted and the places were I've added lines. Pretty much all I've done is remove all lines related to inputenc... –  cfr Mar 16 at 3:34
@Mårten ..., modified the name of the file (to match the filename and to avoid classes with mls) and the file information, and added a warning to the effect that this is not the official style file and is expected to break stuff. –  cfr Mar 16 at 3:35
I get this: Hunk #2 succeeded at 19 with fuzz 1. Hunk #3 FAILED at 56. Hunk #4 FAILED at 115. Hunk #5 FAILED at 147. Hunk #7 succeeded at 367 with fuzz 1. Hunk #8 FAILED at 451. Hunk #9 FAILED at 616. 5 out of 9 hunks FAILED -- saving rejects to file mls-hacked.sty.rej I don't know what I'm doing wrong. I'm on Mac OS. –  Mårten Mar 16 at 12:44