4

First I want to apologise in case the question has already been asked, although I failed to find the topic on this site. So here's the thing :

I've recently begun to type my lessons in LaTex using TeXnicCenter. But, as I'm writing in french, I have to use a lot of accentuated characters (e.g. à, é, è, ê, ...).

Thus, I frequently have to use the "find and replace" tool to find those characters and replace them with the corresponding code (e.g. `a, \'e, ...), so that I can read the pdf output document. But as I have to do this for every different character each time I want to take a look at the document I'm working on, it takes me a lot of time...

So I'm looking for a way to automate this task, maybe with a macro instruction (associated to a shortcut if possible), which could find and replace all of these characters with the corresponding code portion. I don't know how to do this on TeXnicCenter...

(Or maybe a simpler way would be to find a package allowing the use of accentuated letters without having to type the corresponding code)

Can someone help me with this? Thank you!

Edit:

As some of you requested, here's an excerpt of what I'm currently working on:

\documentclass[a4paper, twoside]{article}

\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{layout}
\usepackage[top=2cm, bottom=2cm, right=2cm, left=2cm]{geometry}

\begin{document}
n'existe qu'\`a l'\'etat macroscopique. L'ensemble de ces variables constitue les \textbf{variables d'\'etat du syst\`eme}.
\end{document}

You can see I already have fontenc and imputenc in my headlines. I don't understand why it still doesn't recognise accents. Could it be my Latex distribution? I'm currently on MiKTeX...

Edit 2:

Ok so thanks everybody for your help, I actually found the solution on this post, thanks to a comment left by fpast on Joachim Wuttke's answer. The thing was my encoding was ANSI, and when I set encoding to UTF-8 it worked right away :) Thank you all!

  • Welcome to TeX.SX! Please help us to help you and add a full minimal working example (MWE) 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}. Is easier for us in this way can help you copiyng and running code instead watch a screenshot. – Aradnix Apr 22 '15 at 17:57
  • 2
    Well, write in LaTeX in that awful way is old fashioned. You can do it so in a civilized way with packages such as \usepackage[utf8]{inputenc} fontenc and babel(with French of course) if you still use pdflatex. – Aradnix Apr 22 '15 at 18:07
3

Don't. Just don't typeset é as \'e, if you need lots of them. Typeset them as é using your French keyboard, store the file as utf-8, and compile with a Unicode-aware TeX engine like xelatex.

See, however, the comments below the answer of T. Verron: xelatex is not the standard engine. Therefore you might prefer a solution that works with pdflatex.

5

You can also do it with latex or pdflatex, by using the packages fontenc (encoding for the printed text) and inputenc (encoding for the source file).

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}

àâéèêîôùû

\end{document}

You can see this question for more details.

  • 1
    Yes, you can. But why should a beginner nowadays start with latex or pdflatex. I converted to xelatex two years ago, and would never consider to go back. It has become so much easier to include all kinds of figures ... – Joachim W Apr 22 '15 at 18:10
  • 2
    @JoachimWuttke Would that it was so simple. You have not always the choice. If your colleagues/thesis director/journal work with whatever engine, you must sometimes do like them. Or you may choose LaTeX/PDFLaTeX because they are (or seem) more reliable, and/or because there is an abundant literature/documentation over them. Etc. I switched myself to LuaLaTeX recently, and do not regret it, but I have the advantage (or disadvantage?) of being on my own for the texts I write. – Franck Pastor Apr 22 '15 at 18:23
  • 1
    @JoachimWuttke One might also ask "why learn xelatex today when you can just use lualatex?" There is always a more recent gadget... Learning xelatex, or lualatex, is a formality if you already know latex. If you don't, every time you have a problem, you will have to filter out all answers which do not target the product you use (even if they do work, you can't know in advance). Both options have pros and cons, having both answers here is a good thing in my opinion. – T. Verron Apr 22 '15 at 18:26
  • 3
    @JoachimWuttke xelatex and lualatex have advantages (especially for Asian encodings) but (pdf)latex is still the default reference engine and many publications and archives that accept latex source will only accept classic latex files. I'd be wary of suggesting a non standard engine to a beginner without mentioning that it is non standard. I'm amazed that you give figure inclusion as an advantage of xetex to be honest, the dvipdfmx support is fine but closely modelled on dvips's figure inclusion. – David Carlisle Apr 22 '15 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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