Skip to content

Instantly share code, notes, and snippets.

@bellbind
Created August 10, 2012 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bellbind/3316964 to your computer and use it in GitHub Desktop.
Save bellbind/3316964 to your computer and use it in GitHub Desktop.
[latex][japanese]lualatex example
% lualatex hello-lualatex.tex
\documentclass{ltjsarticle}
\usepackage{luatexja-fontspec}
\usepackage{luacode}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{moreverb}
\title{日本語UTF-8で\LaTeX : Lua\LaTeX}
\author{bellbind}
\date{2012年8月10日}
\begin{document}
\maketitle
{Lua\TeX}\footnote{\url{http://www.luatex.org/}}は、
{\TeX}拡張をプログラミング言語Lua\footnote{\url{http://www.lua.org/}}で
記述できるようにしたものです。
ディストリビューションtexlive 2012\footnote{\url{http://www.tug.org/texlive/}}
に標準で含まれており、
日本語文書でも利用可能です。
{Lua\LaTeX}での日本語文書用プリアンブルは以下のとおり。
\begin{lstlisting}[frame=single]
\documentclass{ltjsarticle}
\usepackage{luatexja-fontspec}
\end{lstlisting}
あとはtexファイルの文章をUTF-8で記述して、{\tt lualatex}コマンドで
コンパイルすれば直接PDFが出来上がります。
\begin{lstlisting}[frame=shadowbox]
lualatex foo.tex
\end{lstlisting}
ちなみにLua{\LaTeX}では、texソース中に、
Luaスクリプトを以下のように埋め込むことができます。
\begin{lstlisting}[frame=single]
\usepackage{luacode}
\luaexec{
tex.print("こんにちは{\\LaTeX}")
}
\end{lstlisting}
スクリプトコード中のバックスラッシュの扱いには注意が必要です。
\end{document}
@bellbind
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment