Math & ScienceAccented Characters in Label Declaration

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
hgylfason
Posts: 1
Joined: Wed Nov 16, 2011 10:29 pm

Accented Characters in Label Declaration

Post by hgylfason »

I am trying to have accent characters in label. Here is my preamble

Code: Select all

\documentclass[a4paper,10pt,onecolumn]{article}
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{tocloft}
\usepackage{xstring}

\makeatletter
\numberwithin{equation}{section}

% we use this for our refernces as well
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}

% redefinition of \equation for convenience
\let\oldequation = \equation
\let\endoldequation = \endequation
\AtBeginDocument{\let\oldlabel = \label}% \AtBeginDocument because hyperref redefines \label
\newcommand{\mynewlabel}[1]{%
  \StrBehind{#1}{eq:}[\Str]% remove "eq:" from labels
  \myequations{\Str}\oldlabel{#1}}
  \renewenvironment{equation}{%
  \oldequation
  \let\label\mynewlabel
}{\endoldequation}

\newcommand{\listequationsname}{\Large{Jöfnur}}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
      \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}}
\setlength{\cftmyequationsnumwidth}{3em}

\makeatother

And here is where I have my problem

Code: Select all

\begin{equation}\label{eq:Hér þarf örn}
	E = mc^2
\end{equation}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Accented Characters in Label Declaration

Post by Stefan Kottwitz »

Hi,

characters in label keys, which are not ASCII characters, are not supported, even if some may work with inputenc under circumstances.

Stefan
LaTeX.org admin
Post Reply