Forums: 公開討議/質問 (Thread #37458)

How do I set the default to gothic? (2016-01-26 05:14 by alaska #77551)

I am using LuaLaTex with package minted to show source code for the Go computer language. I would like all Kanji appearing in the code listings to be gothic format, but I cannot use latex in the code, because it is basically a verbatim environment. Instead, I want gothic to be the default kanji style for the entire document. How do I do this?

Reply to #77551×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: How do I set the default to gothic? (2016-01-26 14:15 by kmaeda #77552)

> Instead, I want gothic to be the default kanji style for the entire document. How do I do this?

Load luatexja-fontspec and use \setmainjfont.
Example:

\documentclass{article}
\usepackage{luatexja-fontspec}
\usepackage{minted}
\setmainjfont{IPAexGothic}
\begin{document}
一二三四五六七八九〇
\begin{minted}[linenos]{python}
print("Hello")
print("こんにちは")
\end{minted}
\end{document}


> I would like all Kanji appearing in the code listings to be gothic format

This is also possible by redefining \ttfamily.
Example:

\documentclass{article}
\usepackage{luatexja}
\makeatletter
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
\romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
\makeatother
\usepackage{minted}
\begin{document}
一二三四五六七八九〇
\begin{minted}[linenos]{python}
print("Hello")
print("こんにちは")
\end{minted}
\end{document}
Reply to #77551

Reply to #77552×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: How do I set the default to gothic? (2016-01-27 02:36 by alaska #77559)

[Reply To Message #77552]
Thank you! This works perfectly.
Reply to #77552

Reply to #77559×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login