# Thích Nhất Hạnh in LaTeX tufte-book class

I am very new to LaTeX and am wanting to use the OVERLEAF.com template found here: https://www.overleaf.com/latex/templates/book-design-inspired-by-edward-tufte/gcfbtdjfqdjh

I am using MiKTeX.
I am trying to include this name in my book: Thích Nhất Hạnh

but have not yet been successful.

I tried to modify the template by including the following packages:

\usepackage[utf8]{inputenc}
\usepackage{ucs}


But I am still getting an error:

> Undefined control sequence. Thích Nhấ


I am hoping there is a simple fix. I welcome any tips, answers, suggestions!

Thanks for the suggestion of adding: \usepackage[T1]{fontenc}

These were the resulting errors by adding that package:

Unicode character ạ (U+1EA1) not set up for use with LaTeX. Thích Nhất Hạ

Unicode character ấ (U+1EA5) not set up for use with LaTeX. Thích Nhấ



I tried the font substitution approach below. These were the resulting errors:

pdfTeX error (font): invalid font identifier. \begin{document}

Font \T5/mdugm/m/n/10=nullfont not loadable: Metric (TFM) file not found. \begin{document}

Font T5/EBGaramond-OsF/m/n/10=ugmr8v at 10.0pt not loadable: Metric (TFM) file not found. \begin{document}


HERE IS MY MWE:


\documentclass{tufte-book}
\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
\author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
\publisher{Publisher of This Book}
\usepackage{ebgaramond}
\usepackage{xcolor}
\usepackage{amssymb,amsmath}
\usepackage{todonotes}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{listings}
\usepackage[toc,page]{appendix}
\usepackage{epspdfconversion}
\usepackage[toc]{glossaries}
\usepackage{multirow}
\usepackage[utf8]{inputenc}
\usepackage{ucs}
\usepackage{microtype}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}
\usepackage{units}
\providecommand{\XeLaTeX}{X\lower.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\LaTeX}
\usepackage{makeidx}
\usepackage[T5,T1]{fontenc}
\usepackage[english]{babel}
\usepackage{mathdesign}

\DeclareFontFamilySubstitution{T5}{\familydefault}{mdugm}

\newcommand{\vietnamese}{\fontencoding{T5}\selectfont}
\DeclareTextFontCommand{\textvietnamese}{\vietnamese}

\begin{document}

This is English text, the Vietnamese name
\textvietnamese{Thích Nhất Hạnh} prints as well.

\end{document}

• Please write a minimal working example. See link for more details what it means. Jan 23 at 6:40
• Might be duplicate of pdftex - How to use Garamond font in Vietnamese - TeX - LaTeX Stack Exchange. Not sure. Seems pretty standard though. Jan 23 at 10:41
• Have you try vntex? Jan 25 at 7:28
• I have not, but would like to stick with MiKTex if at all possible. Jan 25 at 7:49
• @user202729 Thanks for your suggestion of looking into that discussion. It appears promising, but the only issue I see is that it still is using \usepackage[utf8]{vietnam} which gives me three errors when I try to include it: 1) pdfTeX error (font): invalid font identifier. \begin{document} 2) Font \T5/mdugm/m/n/10=nullfont not loadable: Metric (TFM) file not found. \pgfsetxvec{\pgfpoint{1cm}{0cm}} 3) Font T5/EBGaramond-OsF/m/n/10=ugmr8v at 10.0pt not loadable: Metric (TFM) file not found. \pgfsetxvec{\pgfpoint{1cm}{0cm}} Jan 28 at 10:20

We often use

\usepackage[utf8]{vietnam}


for typing Vietnamese language in LaTeX (I am a Vietnamese).

Hope this helps!

\documentclass{tufte-book}
\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
\author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
\publisher{Publisher of This Book}
\usepackage[utf8]{vietnam}
\begin{document}
Thích Nhất Hạnh
\end{document}

• I tried this approach. This is the error I received in my MWE: Command \acircumflex unavailable in encoding T1. Thích Nhấ Jan 25 at 4:27
• @Steven I guess there is some conflict of 'vietnam' and other packages. Maybe changing the order of loading packages will help Jan 25 at 4:41
• I can't use this approach because it causes other parts of my book to show up in Vietnamese instead of English. Jan 25 at 5:47
• @Steven Vietnamese people often use Unikey software to type Vietnamese characters (install at unikey.org/en then the button V is used to type Vietnamese characters, switching to the button E is used to type English characters). It does not affect other languages (English, Russian, etc) Jan 25 at 6:41
• For example, with V button on the Unikey logo, you type Thichs Nhaats Hanhj, then you get Thích Nhất Hạnh Jan 25 at 6:53

\usepackage{ucs} is never the answer. What you want is to use T5 (Vietnamese) encoding for the name. The EB-Garamond fonts don't support Vietnamese, but there is an implementation of Garamond that does, namely mathdesign’s, and the result seems not bad.

In the example code below I only kept the necessary bits.

\documentclass{tufte-book}

\usepackage[T5,T1]{fontenc}
\usepackage[english]{babel}
\usepackage{ebgaramond}

% there is no support of EB-Garamond to Vietnamese
% but vntex provides a Garamond font based on mathdesign
\DeclareFontFamilySubstitution{T5}{\familydefault}{mdugm}

% define commands to switch to the Vietnamese encoding
\newcommand{\vietnamese}{\fontencoding{T5}\selectfont}
\DeclareTextFontCommand{\textvietnamese}{\vietnamese}

\begin{document}

This is English text, the Vietnamese name
\textvietnamese{Thích Nhất Hạnh} prints as well.

\end{document}


If you're wanting to switch to XeLaTeX, it's even simpler and the accents come out better.

\documentclass{tufte-book}

\usepackage[english]{babel}
\usepackage{ebgaramond}

\begin{document}

This is English text, the Vietnamese name
Thích Nhất Hạnh prints as well.

\end{document}


• That ấ looks distinctly wrong and un-Vietnamese to me. The acute should be offset to the right of the circumflex, not added on top of it. Jan 24 at 17:53
• @JanusBahsJacquet Sorry, but that's what the font provides. I added the output obtained with XeLaTeX, which seems much better. Jan 24 at 18:05
• I tried this approach. these are the errors it produced in my MWE: pdfTeX error (font): invalid font identifier. \textvietnamese{Thích Nhất Hạnh} Font \T5/mdugm/m/n/10=nullfont not loadable: Metric (TFM) file not found. \textvietnamese{Thích Nhất Hạnh} Font T5/EBGaramond-OsF/m/n/10=ugmr8v at 10.0pt not loadable: Metric (TFM) file not found. \textvietnamese{Thích Nhất Hạnh} Jan 25 at 4:23
• @Steven Likely, you don’t have mathdesign installed. What TeX distribution are you using? Jan 25 at 8:45
• @Steven You need to install mathdesign with the MiKTeX package manager. Jan 25 at 10:27

I would strongly recommend that you (a) switch to XeLaTeX or LuaLaTeX -- if you want to keep using the microtype package, you should probably go for LuaLaTeX -- and (b) employ text fonts that have the Vietnamese glyphs all set up. There are many such OpenType fonts by now. I've had good experience with Noto Serif and Noto Sans; both of these fonts may be downloaded for free from Google. Calibri might be a suitable choice for sans-serif text.

\documentclass{tufte-book}
\usepackage[vietnamese,english]{babel}
\usepackage{fontspec}
\setmainfont{Noto Serif}
\setsansfont{Noto Sans}
\newcommand{\blurb}{The Vietnamese name Thích Nhất Hạnh prints as well.}
\begin{document}
\blurb

\sffamily
\blurb

\setsansfont{Calibri}[Scale=MatchLowercase]
\sffamily
\blurb
\end{document}

• thanks for this recommendation. I am brand new to this LaTeX world and it has been 30 years since I have done any programming. A quick google search revealed very little discussion about using the Tufte-Book class or even Tufte-Latex class with LuaTeX. One thread discussed how using \maketitle was problematic without an odd fix, so I am hopefully understandably leary of venturing down a path that may open up a can of worms. Also, I may not need the microtype package. It was commented out of the Tufte-Book Template on Overleaf, so perhaps it won't be needed for my purposes. Jan 28 at 8:47
• I'm hoping to find a solution using pdflatex and tufte-book class. I just tried to compile my book (not the MWE above) using xelatex that comes with my MiKTeX distribution and faced a lot of errors which would take me a long time to debug. But even running the tufte-book template found on OVERLEAF through xelatex generates a lot of errors. Jan 28 at 9:31
• @Steven - May I suggest you post a new query to raise the issues you're experiencing with the tufte-book class and XeLaTeX?
– Mico
Jan 28 at 9:38
• Thanks for this worthy suggestion. Unfortunately, just running the tufte-book class template found on overleaf.com using the XeLaTeX engine that came with my protext bundled distribution generated too many errors for me to justify spending my time on it. Converting the template to a XeLaTeX friendly template is outside my expertise (I'm a total newbie with LaTeX), and would be best handled by the folks who maintain the Tufte-LaTeX class or package or whatever it is rightly called. Jan 30 at 10:25

Well, after a ton of trial and error and cutting and pasting pieces of code from two different threads (this thread and this one: How can I temporarily type a text with different font that defined in the style file?), I have luckily stumbled upon this solution. Even though it doesn't look all that great, it works. It results in a warning that ebgaramond was not found and a substitution made, but no errors! Thank you for all the help and suggestions!

\documentclass{tufte-book}
\usepackage[T5,T1]{fontenc}
\usepackage[english]{babel}
\usepackage{ebgaramond}
\newenvironment{myfont}[2][]{\csname#2\endcsname[#1]}{}% ENVIRONMENT FOR NEW FONT
\newcommand\fontsub[3][]{\begin{myfont}[#1]{#2}#3\end{myfont}}
\newcommand{\Gmd}[1][]{\fontfamily{ebgaramond}#1\selectfont}
\DeclareFontFamilySubstitution{T5}{\familydefault}{ebgaramond}

% define commands to switch to the Vietnamese encoding:
\newcommand{\vietnamese}{\fontencoding{T5}\selectfont}
\DeclareTextFontCommand{\textvietnamese}{\vietnamese}

\begin{document}
Original font \fontsub[\fontsize{10}{16}]{Gmd}{\textvietnamese{Thích Nhất Hạnh}} returned to original font.
\end{document}