Math and German characters in make4ht

font-encodingsgermanhtlatexmake4ht

I have the problem of using make4ht to compile my file which contains both math symbols and special German characters. If I use option -u I get charset="utf-8" in the head section and teh math is displayed correctly but the German letters (Umlaute) are just strange symbols. If I insert (with a seperate editor) charset="iso-8859-1" in the head section, I see the the German letters correctly but the math is botched.
Does anyone know, how to get that straight? So that the Umlaute are displayed in the text and the math correctly?
Below more information and I cen provide anything I have.
Best,
Christian

In the tex code I use the packages:

\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[ngerman]{babel}
\usepackage{eurosym}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
\usepackage{verbatim}
\usepackage{hyperref}
\usepackage{textcomp}
\usepackage{tabularx}
\usepackage{etoc}

and the command is

make4ht dynvwl.tex minitoc,fn-in,0,index=4,frames,section+,next -c dynvwl.cfg -e dynvwl.mk4 "mathml,mathjax"

(I tried with and without the option -u).

The cfg file is:

\Preamble{xhtml,mathml,mathjax}
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{
    \HCode{
    <meta http-equiv="Content-Type" content="text/html" charset="iso-8859-1" />\Hnewline % Das Charset sollte auf iso-8859-1 gestellt werden, damit die Umlaute richtig angezeigt werden.
    <link type="text/css" rel="stylesheet" media="all" href="https://dynamische-vwl.de/style.css" />\Hnewline %Haupt-Stylesheet
%    <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>\Hnewline
    <link rel="stylesheet" type="text/css" href="https://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />\Hnewline
    <script charset="UTF-8" src='https://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js' type='text/javascript'></script>\Hnewline
    <script src='https://jsxgraph.uni-bayreuth.de/distrib/GeonextReader.js' type='text/javascript'></script>\Hnewline
    <link type="text/css" rel="stylesheet" href="protex/style.css" />\Hnewline %Eigenes Stylesheet für notwendige Anpassungen.
}}

%ersetzten der \initJXGBOARD Varaiblen

%Einfügen des VG-Wort-Zählpixels auf jeder Seite
\Configure{@BODY}{\HCode{<img src="https://vg08.met.vgwort.de/na/ac8bfb254cff4060b2808f78a90a5da5" width="1" height="1" alt="" />}}

%Einfügen der Navigationssidebar/des Inhaltsverzeichnisses auf jeder Seite
\Configure{@BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="mainnavigation"><a href="https://dynamische-vwl.de/"><img src="protex/images/logo.png" /></a><a href="./englisch/"><img src="protex/images/FlagEng.png" /></a>}\TableOfContents\HCode{</div>}}
    % Der gesamte Text wird in das Blockelement "textkoerper" gepackt, um ihn sauber vom Inhaltsverzeichnis trennen zu können.
    \Configure{@BODY}{\HCode{<div class="textkoerper">}}

%Einfügen der Fußzeile und Schließen des textkoerper-div
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div id="fusszeile"><hr />}(c) by Christian Bauer\\Prof. Dr. Christian Bauer\\Lehrstuhl für monetäre Ökonomik\\Universität Trier\\D-54296 Trier\\Tel.: +49 (0)651/201-2743\\E-mail: [email protected]\\URL: \url{https://www.cbauer.de}\HCode{</div></div>}}

%Umbeschriften der "Mini-Navigation" über und unter dem Text %\Configure{crosslinks} {left-delimiter} {right-delimiter} {next} {prev} {prev-tail} {front} {tail} {up}
\Configure{crosslinks}{\space[}{]}{Weiter}{Zurück}{Zurück (Ende)}{Anfang}{Ende}{Hoch}

% Einteilung des Buches in mehrere HTML-Seiten. Funktionsweise am Beispiel des ersten Eintrags: 
%   \CutAt{part,likepart,appendix}
%    Jeder \part erzeugt eine neue HTML-Datei, welche grundsätzlich alles bis zum nächsten \part umfasst. Die Optionen likepart und appendix geben an, dass \part* und \appendix dennoch nicht eingefasst werden, ergo wiederum einen Cut erzeugen.
\CutAt{part,likepart,appendix}
\CutAt{chapter,appendix,part,likepart}
% \Configure{endchapter}{chapter,section}
\CutAt{section,likesection}
\CutAt{subsection,likesubsection}

\Configure{paragraph}{}{}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="paragraphHead">}}{\HCode{</div>}}

\TocAt{part,chapter,section}
\TocAt{chapter,section}
% \def\Tocchapter{\TableOfContents[chapter]}
\TocAt{section,subsection}

%Sorgt glaube ich dafür, dass nicht jeder <p> intendiert.
\Configure{HtmlPar}
{\EndP\Tg<p>}
{\EndP\Tg<p>}
{\HCode{</p>\Hnewline}}
{\HCode{</p>\Hnewline}}

 \begin{document}
 \EndPreamble

Best Answer

The problem is with your command:

make4ht dynvwl.tex minitoc,fn-in,0,index=4,frames,section+,next -c dynvwl.cfg -e dynvwl.mk4 "mathml,mathjax"

You have two different set of options that you want to pass to TeX4ht: "minitoc,fn-in,0,index=4,frames,section+,next" and "mathml,mathjax". The second set of options is misunderstood and it overwrites options for the correct Unicode output. The correct invocation is:

make4ht  -c dynvwl.cfg -e dynvwl.mk4  dynvwl.tex "minitoc,fn-in,0,index=4,frames,section+,next,mathml,mathjax"

Always put make4ht options before TeX file name, and TeX4ht options after that, in order to prevent surprises such as this.

This is how a sample file looks:

\documentclass{article}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[ngerman]{babel}
\usepackage{eurosym}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
\usepackage{verbatim}
\usepackage{hyperref}
\usepackage{textcomp}
\usepackage{tabularx}
\usepackage{etoc}
\begin{document}
äüöůw

\"u\"a

$\"a=2$

\end{document}

And result:

enter image description here

The missing pictures are used in your .cfg file, they don't work on my computer, as I don't have access to them.

Related Question