# Proper use of cmap and mmap

I am curious about the differences between

• \usepackage{cmap}
• \usepackage[resetfonts]{cmap}
• \usepackage{mmap} (= \usepackage[useTeX]{mmap})
• \usepackage[noTeX]{mmap}

What are their precise differences? (I am not familiar with (La)TeX internals, so a beginner's explanation would be very helpful.) If this matters: I am using \usepackage[T3,T1]{fontenc} (with T3 being necessitated by the tipa-package), which is important in my case (but might not be important for a fully general answer to this question).

((Also, I am assuming that each of these commands would need to be loaded after loading package fixltx2e but before loading packages times and fontenc. Is that right?))

Update: Kurt's starter code is great. I have uncommented the tipa-lines, saved the file in UTF-8 (and modified the input encoding line to \usepackage[utf8]{inputenc}, and went through all different cmap/mmap-options. However, I see no difference in the text that is pasted from the output pdf-file (perhaps because the MWE uses virtual fonts (by default?)?). Ideally, perhaps someone could help (both of us have tried a lot) to find a minimal example that shows five different output pasting behaviors when the only difference is whether no cmap/mmap or one of the 4 cmap/mmap options is loaded. Ideally that example would also specify the encoding the file is saved in to make this work (remember to not use a BOM for UTF-8; more importantly I don't know whether all input encodings lead to identical behavior (assuming correct escaping of accented characters in input encodings that don't offer a particular character)).

-
I am sadly not sure - I have a very large working file, and a few ligatures don't paste correctly. The thing is that I don't even know what a good working example would be that would illustrate the differences between these four commands (and my large working file might be mostly irrelevant to this question). Basically I would like to use cmap for proper copy-and-paste abilities, but I've found information online about these other commands, and I'd like to know which one does what. – Lover of Structure Jul 23 '12 at 21:16

The package mmap does a little bit more than cmap, it also works for mathematical symbols in your pdf.

So if your pdf does not use mathematics use \usepackage{cmap}. If you have problems with ligatures further on with computer modern use \usepackage[resetfonts]{cmap}. With mathemtic symbols use \usepackage{mmap}. If you have still problems use \usepackage[noTeX]{mmap}.

The differences are:

• \usepackage{cmap}: accepted preloaded fonts without reloading.
• \usepackage[resetfonts]{cmap}: as you can read in the README of cmap this forces the reloading of preloaded fonts (Computer Modern).
• \usepackage[useTeX]{mmap} and \usepackage{mmap}: does everything cmap does plus correcting mathematical symbols in your pdf; uses new -m.cmap files ("uses ascii strings for the macro-names").
• \usepackage[noTeX]{mmap}: does everything cmap does plus correcting mathematical symbols in your pdf; uses the cmap files (unicode).

Load cmap or mmap first, then fontenc and babel.

The documentation of fixltx2e does only say "load in the preamble". I had no problems loading it after fontenc, babel and the used fonts.

To do your own experiments use the follwing MWE:

\listfiles                      % shows used files
\documentclass[12pt]{scrartcl}
%\usepackage{cmap}              % pure T1 fonts
%\usepackage[resetfonts]{cmap}  % pure T1 fonts, reset CM
%\usepackage{mmap}              % cmap + mathematics (ASCII)
%\usepackage[noTeX]{mmap}       % cmap + mathematics (Unicode)

\usepackage[Latin9]{inputenc}  % or utf-8
\usepackage[T1]{fontenc}       % font encription
%\usepackage[T3,T1]{fontenc}    % T3 for package tipa
%\usepackage{tipa}              % Phonetic alphabet
\usepackage[ngerman]{babel}    % neue deutsche Rechtschreibung

%\usepackage{lmodern}           % Latin Modern
%\usepackage{tgpagella}         % has no virtual fonts
%\usepackage[osf]{mathpazo}     % Minuskelziffern okay

%\usepackage{libertine}         % Libertine Legacy (with virtual fonts)
\usepackage[osf]{libertine}    % mit Medivalziffern bzw. Minuskelziffern

\newcommand*{\III}{\libertineGlyph{Threeroman}}
\newcommand*{\IV}{\libertineGlyph{Fourroman}}

\begin{document}

Römische Zahlen: \III, \IV.

\textsc{Ligaturen}: auffliegen auffinden finden Auflage Schifffahrt.

\textsc{Korrekt}: auf\/fliegen auf\/finden finden Auf\/lage Schiff\/fahrt.

Ziffern: 0123456789.

Donau Donaudampfschiff Donaudampfschifffahrt Donaudampfschifffahrtskapitän
Donaudampfschifffahrtskapitän
Donaudampfschifffahrtskapitän Donaudampfschifffahrtskapitän
Donaudampfschifffahrtskapitän Donaudampfschifffahrtskapitän

%\textipa{[\!b] [\:r] [\;B]}

\end{document}


Set or delete the comment sign to test cmap and mmap with or without fontenc and different fonts.

BTW: "Donaudampfschifffahrtskapitän" is a German word, good to get hyphenations.

-
Thank you. I am wondering what the practical difference between the two mmap commands is and what the practical difference between the two cmap commands is: What would be some code that gives to what precise differences in copy-and-paste behavior for each of these cases? – Lover of Structure Jul 24 '12 at 18:42
Thanks for your advice; it turns out that the actual problem I'm having is a very different, described here. That said, I lack the knowledge to really know how to build an MWE for this question, sorry about that. I'm just trying to use the right package commands. – Lover of Structure Jul 25 '12 at 0:25
No problem - I've created other, concise questions for my other issues. Still I think it'll be good for someone (could be someone else) to help find minimal contrasting examples illustrating the differences in output behavior between these four commands -- because I have tried and wasn't successful. – Lover of Structure Jul 25 '12 at 18:06
@user14996: I did a little research and found some hints how to use cmap or mmap. Result: cmap and mmap can't handle fonts based on virtual fonts (files *.vf or *.vpl). So if your used font needs virtual fonts cmap or mmap can't work. You should better use glyphtounicode. – Kurt Jul 25 '12 at 22:42
Thanks, this is great info! Could you edit your answer to this question to include what you just wrote there? I think that would be a good place for this knowledge. Aside from that, it'll still be great if somebody else can help figure out differences for the four commands mentioned in this question. – Lover of Structure Jul 26 '12 at 5:49