1

I need to type the word "naïve" in plain text in Latex. Things that I've tried: na\"{\i}ve, na{\"{\i}}ve, na\"\i ve, and other combinations of brackets: i dissappears, and this is what I get: naïve result

I tried to switch to math mode and then it works, but I cannot make the \imath to look non-italic, this is what I get from $\mathrm{na\ddot{\imath}ve}$ :

math mode

EDIT: Added minimum working example.

\documentclass[a4paper,11pt]{book}
% bibentry workaround
\makeatletter
\let\saved@bibitem\@bibitem
\makeatother
\usepackage{bibentry}
\nobibliography*

\usepackage[english]{babel}

\usepackage{calc}           % berekeningen voor paginagrootte
\usepackage{afterpage}      % om een \clearpage na einde van pagina te zetten
\usepackage{titlesec}
\usepackage{fancyhdr}

\usepackage[pdftex=true,hyperindex=true,colorlinks=false,hidelinks=true]{hyperref}
\hypersetup{%
    pdfauthor={...},
    pdftitle={...},
    pdfsubject={...}
}

\usepackage[english,tight]{minitoc}
\setcounter{minitocdepth}{2}

\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.jpg, .jpeg, .png}
\graphicspath{{../images/}{images/}}

\usepackage{wrapfig}
\usepackage{subfig}
\usepackage[labelfont=bf,font=small]{caption}
\captionsetup[subfloat]{margin=4pt}

\usepackage{color}
\usepackage[table]{xcolor}

\usepackage{listings}
\lstset{%
    flexiblecolumns=true,
    basicstyle=\ttfamily\footnotesize,
    basewidth=0.4em,
    aboveskip=5mm,
    belowskip=2mm,
    frame=tb,
    frameround=fttt,
    framexleftmargin=2mm,
    framexrightmargin=2mm,
    framextopmargin=1mm,
    framexbottommargin=1mm,
    showspaces=false,
    showstringspaces=false,
    mathescape,
    captionpos=b
}

\lstdefinelanguage{XML}{
    morestring=[b]",
    morestring=[s]{>}{<},
    morecomment=[s]{<?}{?>},
    stringstyle=\color{black},
    identifierstyle=\color{blue},
    keywordstyle=\color{magenta},
    morekeywords={role,content,action,level}
}

\usepackage{url}
\usepackage{array}
\usepackage[figuresright]{rotating}
\usepackage{amssymb,amsmath}

\usepackage[square,comma]{natbib}
\usepackage{appendix}
\usepackage{makeidx}

\usepackage{pdfpages}

%
% new/renew commands
%
\renewcommand{\mtcfont}{\small\rm}
\renewcommand{\mtcSfont}{\small\bf}
\renewcommand{\cite}[1]{\citep{#1}}
\renewcommand{\i}[1]{#1\index{#1}}

%
% make appropriate UHasselt style
%
\titleformat{\chapter}[display]
{\bfseries\Large} 
{\filright{\chaptertitlename} \Huge\thechapter}
{4ex}
{\titlerule\vspace{2ex}\filcenter}
[\vspace{2ex}\titlerule]

\setlength\oddsidemargin{4cm - 1in}
\setlength\evensidemargin{4cm - 1in}
\setlength\textwidth{13cm}

\setlength\topmargin{48mm - 1in}
\setlength\headheight{26pt}
\setlength\headsep{10pt}
\setlength\textheight{20cm - \headheight - \headsep}

\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}{\bfseries\thepage}}
\cfoot{}

%
% custom stuff
%
\vfuzz=2pt % don't report over-full v-boxes if over-edge is small
\hfuzz=2pt % don't report over-full h-boxes if over-edge is small

%\usepackage{tocloft}
%\@addtoreset{section}{part}
%\renewcommand\thepart{\arabic{part}}

%
% prepare things...
%
\def\C++{\leavevmode{\hbox{C\hskip -0.1ex\raise 0.5ex\hbox{\tiny ++}}}} % nice C++ logo
\def\Csharp{\leavevmode{\hbox{C\hskip -0.1ex\raise 0.5ex\hbox{\tiny \#}}}} % nice C# logo

\makeindex
\dominitoc

\begin{document}
    na\"{\i}ve
\end{document}

What could possibly be wrong?

14
  • 2
    na\"ive works for me. No need to escape the i.
    – Huang_d
    Commented Jun 15, 2017 at 11:54
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Commented Jun 15, 2017 at 11:56
  • 3
    The definition of \i as the lazy LaTeX-User form for \index seems to be the cause of the issue
    – user31729
    Commented Jun 15, 2017 at 14:03
  • 1
    @aspsnake: Although seducing in 99.9% of all cases such short track commands with \i etc. bite you in the long end and leave the code hard to track and read. I don't recommend to use them.
    – user31729
    Commented Jun 15, 2017 at 14:09
  • 1
    @aspsnake: Quick, get out of that university if they provide such rubbish templates ;-)
    – user31729
    Commented Jun 15, 2017 at 14:24

2 Answers 2

2

Update for question with MWE (version 3)

The OT1 encoding composes the ï with the accent (\") and the dotless i (\i), because there is no slot available in the 7-bit font encoding. The T1 encoding has slot 239 for this glyph (from t1enc.def):

\DeclareTextComposite{\"}{T1}{i}{239}
\DeclareTextComposite{\"}{T1}{\i}{239}

Therefore the form \"i works without an explicit or implicit \i, thus that \i can even be redefined:

\documentclass{article}
\usepackage[T1]{fontenc}
\renewcommand{\i}[1]{#1\index{#1}}
\begin{document}
na\"ive
\end{document}

Result

 

Older version

Wild guess, based on version 2 of the question without minimal working example (MWE).

The accent command \" is a text command that causes an error in math mode (your question is tagged with ). Switch to text mode to typeset the word, e.g.:

\documentclass{article}
\usepackage{amstext}% or amsmath, provides \text
\begin{document}
\[ \mbox{na\"ive} = \text{na\"ive} \]
\end{document}

Result

0
1

The definition of \i as the lazy LaTeX-User form for \index seems to be the cause of the issue – Christian Hupfer.

Commenting the line \renewcommand{\i}[1]{#1\index{#1}} fixed the problem.

Thanks!!

12
  • It would have been a nice gesture to ask Christian to answer the question and then accept and upvote instead to answer yourself.
    – moewe
    Commented Jun 15, 2017 at 14:47
  • 2
    @TeXnician The answer answers the question. The additional thanking does not change that and is therefore not a reason for closing. Commented Jun 15, 2017 at 14:54
  • I have upvoted to cancel out the downvote. This does indeed answer the question (though I also agree it would have been better to get Christian to answer it… but we shouldn't expect new users to follow norms that aren't even clear to established users. The fact that the OP posted the answer in the answer section is itself a good thing). Commented Jun 15, 2017 at 14:59
  • 1
    @moewe I do not know, why people answers questions in comments, rather writing real answers. This keeps the question in the list of unanswered questions. Therefore, the OP is right to answer the question with the reference to the finder of the problem cause. Commented Jun 15, 2017 at 15:00
  • 1
    @HeikoOberdiek Well, obviously I can't speak for Christian here. I simply explained why I answer in comments sometimes.
    – moewe
    Commented Jun 15, 2017 at 15:18

You must log in to answer this question.

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