# How to copy/paste from Word to LaTeX avoiding error?

With a few school mates, we have written a report in Word/Google Drive. I would like to format it in LaTeX. However, when I copy paste I see that certain characters are not as usual and trigger errors. Besides, I am writing in French, which means there are many characters with accents. I tried using \usepackage[tipa,combine]{ucs} I was able to compile the document but all the accents are gone. The other solution I have is to Find/Replace the accents but I would rather be able to copy/paste it properly. Is there some shortcuts or another package that would allow that?

Preamble:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}


Sample of text that trigger errors:

Pour répondre à cette problématique, deux axes majeurs ont été abordés. D'une part, l'analyse du profil des consommateurs a été réalisée en déployant une étude quantitative au niveau régional. D'autre part, le changement de packaging - au stade de la veille de son lancement au moment de la clôture de l'analyse quantitative - a été analysé en soumettant le nouveau packaging aux consommateurs lors d'une table ronde.

Error log:

! Package ucs Error: Please activate option 'combine'. See the ucs package documentation for explanation. Type H for immediate help. ... l.34 ...�, car la fermentation spontanée du moû t de céréales par des le... Composed characters can only be rendered correctly, when the option 'combine' i s activated

• You need to make sure your file format is UTF8 in order to handle inline accented characters, and use \usepackage[utf8]{inputenc}. – Werner Feb 8 '14 at 0:34
• Or use some converter. – user11232 Feb 8 '14 at 0:39
• I was using \usepackage[utf8x]{inputenc} it works fine when I type from scratch but I get the following error ! Package ucs Error: Please activate option 'combine'. when I copy and paste. – esmitex Feb 8 '14 at 0:45
• Don't mix inputenc and ucs. The only font-related packages you need are [utf]{inputenc}, [T1]{fontenc} and {lmodern}. Then you should be fine. – yo' Feb 8 '14 at 0:53
• I happened to have such a message. Often it was because the encoding was a mess (e.g. a mix of Apple Roman and ansinew). In such a case the only solution I found was a search-and-replace (with an editor that asks you each time when you say "Replace All" if possible). – Bernard Feb 8 '14 at 1:10

## 4 Answers

I'd avoid utf8x and certainly not use the combine option for ucs. Use utf8 and you'll be on the right track. Of course the input file should be saved as UTF-8.

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage{microtype}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

Pour répondre à cette problématique, deux axes majeurs ont été abordés. D'une part,
l'analyse du profil des consommateurs a été réalisée en déployant une étude quantitative au
niveau régional. D'autre part, le changement de packaging ---~au stade de la veille de son
lancement au moment de la clôture de l'analyse quantitative~--- a été analysé en soumettant le
nouveau packaging aux consommateurs lors d'une table ronde.

\end{document}


I added also microtype that allows for better line breakings. Note that wrong input must be corrected: I'm referring to the dashes, because a hyphen can never be used as a dash.

Your accents are gone after compiling most probably because you forgot to load any font and didn't declare the font encoding. So the Computer Modern (cm) fonts were used and these, being coded on 7 bits, do not have any accented letters. You juste have to add these lines to your preamble:

\usepackage[T1]{fontenc}
\usepackage{lmodern}


if you want to use the Latin Modern (lm) fonts. They are the equivalent of the cm fonts on 8 bits. But you can use a lot of other T1-encoded fonts (fourier, kpfonts, &c.)

You can take a look at this site: http://luc.devroye.org/tex.html

• They are still gone. I also tried \usepackage{mathptmx}. With this \usepackage[utf8]{inputenc} \usepackage[combine]{ucs} \usepackage[francais]{babel} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{mathptmx} – esmitex Feb 8 '14 at 0:51
• You cannot use simultaneously lmodern and mathptmx. Try without the ucs package, inputenc should be enough. Do you use a unicode editor? If you use TeXshop on a Mac, for instance, the default encoding is Apple Roman. – Bernard Feb 8 '14 at 1:04
• I tried all possible combination. Without ucsif I do not replace the weird characters it will trigger error. With any font I use with inputencall the accents disappear. – esmitex Feb 8 '14 at 1:18
• Could you send a fragment of your text (reproducing the error) and the whole preamble? What does the log says? – Bernard Feb 8 '14 at 1:31
• Btw, you also can look at thises question/answers: [link]tex.stackexchange.com/questions/27731/… – Bernard Feb 8 '14 at 1:37

I guess for now the best option is to "Find" and "Replace all" and pray that there are not too many weird accents. I tried with other LaTeX editor and I would get the same error so

I had the same problem. As already stated the problem lies in the coding of the copied text from word. By saving the word document as a text file you can choose the coding and can adapt this to the one you use in LaTeX. After saving the document copy and paste should work without problems.