2

How do I install the Japanese dmjhira font in MikTex 2.9?

I am trying to do the same task as mentioned in the above question. My goal is to produce the Hiragana "yo" character in my latex file. Right now, I am trying a small test code which is exactly the one in the solution provided to the above question

\documentclass{book}

\begin{document}
    abc
    \font\maljapanese=dmjhira at 2ex 
    \maljapanese \char"48
    
\end{document}

I am trying to compile it use TeXstudio using PdfLaTeX compile. And I get the following log files where I have hidden some personal information using <---> in the file paths.

  1. makepk-log
2022-12-04 21:35:19,271-0500 INFO  miktex-makepk - this process (16864) started by pdflatex in directory D:\Local Drive\<Univ>\<sem>\Math R\Documents\Set-2\Test with command line: miktex-makepk --verbose dmjhira 517 600 0+517/600
2022-12-04 21:35:19,273-0500 INFO  miktex-makepk - running on Windows 10.0.22621
2022-12-04 21:35:19,275-0500 INFO  makepk - Trying to make PK font dmjhira at 517 DPI...
2022-12-04 21:35:19,279-0500 INFO  makepk - The METFAONT mode is: ljfour
2022-12-04 21:35:19,281-0500 INFO  makepk - Running miktex-makemf.exe...
2022-12-04 21:35:19,281-0500 INFO  makepk - running: miktex-makemf.exe --miktex-disable-maintenance --miktex-disable-diagnose --verbose dmjhira
2022-12-04 21:35:19,281-0500 INFO  miktex-makepk.core - start process: miktex-makemf.exe --miktex-disable-maintenance --miktex-disable-diagnose --verbose dmjhira
2022-12-04 21:35:19,611-0500 INFO  makepk - Running miktex-ttf2pk.exe...
2022-12-04 21:35:19,611-0500 INFO  makepk - running: miktex-ttf2pk.exe --miktex-disable-maintenance --miktex-disable-diagnose -q -t dmjhira
2022-12-04 21:35:19,611-0500 INFO  miktex-makepk.core - start process: miktex-ttf2pk.exe --miktex-disable-maintenance --miktex-disable-diagnose -q -t dmjhira
2022-12-04 21:35:20,043-0500 FATAL miktex-makepk - PK font dmjhira could not be created.
2022-12-04 21:35:20,043-0500 FATAL miktex-makepk - PK font dmjhira could not be created.
2022-12-04 21:35:20,043-0500 FATAL miktex-makepk - Info: 
2022-12-04 21:35:20,043-0500 FATAL miktex-makepk - Source: 
2022-12-04 21:35:20,043-0500 FATAL miktex-makepk - Line: 0
2022-12-04 21:35:20,051-0500 INFO  miktex-makepk - this process (16864) finishes with exit code 1
  1. makemf-log
2022-12-04 21:35:19,533-0500 INFO  miktex-makemf - this process (5260) started by miktex-makepk in directory C:\Users\<name>\AppData\Local\Temp\mik38448 with command line: miktex-makemf.exe --miktex-disable-maintenance --miktex-disable-diagnose --verbose dmjhira
2022-12-04 21:35:19,533-0500 INFO  miktex-makemf - running on Windows 10.0.22621
2022-12-04 21:35:19,537-0500 FATAL miktex-makemf - The dmjhira source file could not be found.
2022-12-04 21:35:19,537-0500 FATAL miktex-makemf - The dmjhira source file could not be found.
2022-12-04 21:35:19,537-0500 FATAL miktex-makemf - Info: 
2022-12-04 21:35:19,537-0500 FATAL miktex-makemf - Source: 
2022-12-04 21:35:19,537-0500 FATAL miktex-makemf - Line: 0
2022-12-04 21:35:19,545-0500 INFO  miktex-makemf - this process (5260) finishes with exit code 1

I have installed MiKTeX for one user only which ended up getting installed in

C:\Users\<name>\AppData\Local\Programs\MiKTeX

Here's what I have tried so far.

  • Refreshing font map files in the Task Menu
  • Using commands such as updmap.exe at the address C:\Users\<name>\AppData\Local\Programs\MiKTeX\miktex\bin\x64
  • Tried to do the same while running the MiKTeX console or the cmd in administrator mode.
  • It is also weird that this file compiles when using XeLaTeX compiler in TeXstudio instead of PdfLaTeX.

Lastly, despite what it shows in the log, I am running the latest version of Windows 11 and I am using a Surface Pro 9.

I am also suspecting that it might be some sort of windows permission errors? Though, I am just not sure what is going wrong. In a similar way, the makeidx package doesn't work for me too. It shows error like main.ind not found and in the working directory folder main.ind is never generated as well.

6

3 Answers 3

1

You need to properly install the cjk-fonts package of MiKTeX and to update the system, in particular the map files.

On TeX Live those fonts are in wadalab, but apparently MiKTeX only offers a bundle containing them.

Once you have the setup done, you need to modify the code for choosing the font, because the \font declaration should never be used in LaTeX directly (the code you got is for plain TeX).

If the type1 font map file isn't good (which appears to be the case in the current MiKTeX), you can add a line to the LaTeX document, at least until the bug is fixed.

\pdfmapline{+dmjhira dmjhira <dmjhira.pfb}

\documentclass{book}

\DeclareFontFamily{U}{dmjhira}{}
\DeclareFontShape{U}{dmjhira}{m}{n}{
  <-> dmjhira
}{}
\DeclareFontSubstitution{U}{dmjhira}{m}{n}

\newcommand{\yo}{{\usefont{U}{dmjhira}{m}{n}\symbol{"48}}}


\begin{document}

abc \yo\ def

\end{document}

enter image description here

However, these fonts have quite a big bounding box and this might interfere with pagination and line spacing.

\documentclass{book}

\DeclareFontFamily{U}{dmjhira}{}
\DeclareFontShape{U}{dmjhira}{m}{n}{
  <-> s*[0.95] dmjhira
}{}
\DeclareFontSubstitution{U}{dmjhira}{m}{n}

\newcommand{\yo}{%
  \raisebox{0.2\depth}[\fontcharht\font`A][0.1\depth]{%
    \usefont{U}{dmjhira}{m}{n}\symbol{"48}%
  }%
}


\begin{document}

\fboxsep=0pt\fboxrule=0.1pt
\fbox{A}\fbox{\yo}\fbox{b}

abc \yo\ def

\end{document}

With this code the size of the characters is reduced by 5%, slightly raised, with the bounding box fixed.

enter image description here

4
  • there is a bug in miktex, the map files are currently not in the correct location. I opened an issue at github.com/MiKTeX/miktex-packaging/issues/310 Dec 5, 2022 at 10:39
  • @UlrikeFischer The \pdfmapline trick should momentarily fix the problem.
    – egreg
    Dec 5, 2022 at 10:44
  • ah, yes I didn't read that. That works (loading the map files with \pdfmapfile doesn't, the map is not in the search path.) Dec 5, 2022 at 10:50
  • THANK YOU! That \pdfmapline command fixed the issues! It seems. However, for the sake of bug tracking, I could still send the log file if needed. But I don't know which file to locate and upload. @UlrikeFischer
    – Someone
    Dec 6, 2022 at 4:41
1

You can get a hiragana "yo" using the following code, which was taken from a paper of Johnson-Freyd and Scheimbauer and also appears now on the nlab. I do not understand this code, but it works in Overleaf for me. I don't think it requires installing the dmjhira font.

\usepackage[utf8]{inputenc}
\DeclareFontFamily{U}{min}{}
\DeclareFontShape{U}{min}{m}{n}{<-> udmj30}{}
\newcommand\yo{\!\text{\usefont{U}{min}{m}{n}\symbol{'207}}\!}`
0

The answers so far all discuss how to load a legacy 8-bit font. You might need to do this if your publisher or professor still requires you to use PDFTeX, but I would recommend using the modern toolchain, with Unicode and desktop fonts, when you can. This cuts a number of Gordian knots.

Here is a MWE that loads よ from Harano Aji Mincho, a font available from CTAN. It demonstrates using the symbol in text, bold text and math.

\documentclass{article}
\tracinglostchars=3
\usepackage{amsmath}
\usepackage{fontspec}

\defaultfontfeatures[HaranoAjiMincho]{
    Renderer=HarfBuzz,
    Script=Kana,
    Scale=MatchUppercase,
    UprightFont=*-Light,
    BoldFont=*-Medium,
    Extension=.otf
}

\newfontfamily\kanafont{HaranoAjiMincho}
\DeclareRobustCommand\yo{\textup{\kanafont よ}}

\begin{document}
The Hirigana for \textit{yo} is {\yo}.

\section*{The Yoneda Embedding \yo}
The Yoneda embedding is \(\yo(\mathcal{K})\).
\end{document}

Harano Aji Mincho sample

To be able to use the literal よ character in your source, add the lines:

\usepackage{newunicodechar}
\newunicodechar{よ}{\yo}

You must log in to answer this question.

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