3

I want to be able to use the ansinew characters in a latex document. According to the pdf file for the inputenc package, I can do that by putting \usepackage[cp1252]{inputenc} in my preamble. I do that, but when I put things like \guilsinglleft in my document, I get the error ! LaTeX Error: Command \guilsinglleft unavailable in encoding OT1. when compiling.

I'm not going into great detail here, because I assume I am making some very basic mistake, being new to latex.

3

2 Answers 2

5

The ... unavailable in encoding OT1 error means, as Herbert said, that your problem is related to your font encoding and can be solved by loading the appropriate font encoding.

As you said you are new to LaTeX, maybe you want to also read What packages do people load by default, where you can learn that if you load T1 font encoding, you should usually also load a vector font, for example lmodern, and probably the babel package (the order does not matter).

Also you could consider to use utf8 as input encoding instead of cp1252, because today most editors do support utf8 and maybe at some point your input will have characters that are not available in cp1252. But you can as well switch any time later.

Maybe some time later you want references, then you should take a look at biblatex and biber.

Putting all these hints together, you get a MWE that looks like this (as an answer to your question the 4 lines fontenc...lmodern are sufficient):

\documentclass[
    a4paper,
    final
]{scrartcl}

\usepackage[T1]{fontenc} % font encoding
\usepackage[utf8]{inputenc} % input encoding
\usepackage[french]{babel} % keyword translation and hyphenation
\usepackage{lmodern} % lmodern looks better than cm-super

\usepackage[
    babel=true,
    verbose=true
]{microtype}

\usepackage[]{graphicx} % if you want figures
\usepackage[autostyle]{csquotes} % quotes

\usepackage[
    backend=biber,
    style=authoryear-icomp,
    sortlocale=fr_FR,
    natbib=true,
    url=false, 
    doi=true,
    eprint=false
]{biblatex}
\addbibresource{biblatex-examples.bib} % just an example
%\addbibresource{\jobname.bib} % include your own bib file

\usepackage[]{hyperref}
\hypersetup{
    colorlinks=true,
}


%% ===========================
\begin{document}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, 
sed diam voluptua. 
At vero eos et accusam et justo \citet{kastenholz} et ea rebum. 
Stet clita kasd gubergren, 
no sea takimata sanctus est Lorem ipsum dolor sit amet. 

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, 
sed diam voluptua. 
At vero eos et accusam et justo duo dolores et ea rebum. 
Stet clita kasd gubergren, 
no sea takimata sanctus est Lorem ipsum dolor sit amet~\citep{sigfridsson}.

\printbibliography 

\end{document}
2
  • Thanks! Turns out that I also needed \usepackage{lmodern} to get the document to compile. I couldn't find any documentation for fontenc in the package archive, so I don't really know what this package does, but ...
    – Sverre
    Nov 20, 2011 at 22:33
  • Some more info, because I just read a related question: If you \usepackage[T1]{fontenc} it will give you real umaluts instead of diacritic characters, but by default it will load bitmap fonts, so you should also load a vector font.
    – matth
    Feb 25, 2012 at 11:17
6

add \usepackage[T1]{fontenc} to your document preamble. Input encoding and font encoding are two different things ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .