質問用フォーラムです。ご質問の前に質問のしかたをご覧ください。

XeTeXやLuaTeXでUnicode文字を置き換えるマクロ

- TrueRoad の投稿
XeTeXやLuaTeXでも、デフォルトのフォントは普通のTeXと同じ Computer Modern なので、そのまま特にフォントの設定をせずに、「ü」(U+00FC LATIN SMALL LETTER U WITH DIAERESIS) のような文字を UTF-8 で直接ソース中に記述すると、文字が出てこない、ということになると思います。
もちろん、フォントを Latin Modern などの Unicode に対応したものに変えれば出てくるようになります。また、たとえデフォルトフォントのままでも、普通のTeXと同じように「\"u」のように書けば出てくるようになります。

ですが、あえて、デフォルトフォントのまま、かつ、UTF-8 の文字のままこのような文字を出せるようにしたいと思っています。

以下のようなことをすると、とりあえず「ü」が「\"u」に置き換えられるので、上記の目的は達成できることがわかりました。
(LaTeXではありません。)

% -*- encoding: utf-8 -*-

\catcode`^^^^00fc=\active
\def^^^^00fc{\"u}

für

\bye

あとは置き換えの定義をたくさん書いていけばよい、ということになるのですが、それなりにたくさん必要になります。そこで、上記のサンプルではカテゴリコードの書き換えと文字の置き換えの2行に分かれているものを1行で書けるようにマクロを作りたいと思っています。

\DeclareUnicodeCharacter{00FC}{\"u}

と書くと、

\catcode`^^^^00fc=\active
\def^^^^00fc{\"u}

に展開されるようなマクロです。
カテゴリコードの書き換えまでは何とかできたのですが、
文字の置き換えで苦戦しています。
カテゴリコードの書き換えだけであれば、

\newcount\countUTFz

\def\DeclareUnicodeCharacter#1#2{%
\countUTFz = "#1\relax
\catcode\countUTFz=\active
% ここで文字の置き換えもしたい
}

のようにするとできましたが、文字の置き換えができません。

皆さまのお力添えをいただければ幸いです。
よろしくお願いいたします。

「図1-1」と表示されてしまうが「図1」にしたい

- ta yo の投稿

%--^

\usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm, includefoot]{geometry}

\usepackage[dvipdfmx]{graphicx}

\usepackage[dvipdfmx, hidelinks]{hyperref}

\usepackage[numbers, sort]{natbib}

\usepackage{url}

\usepackage[at]{easylist}

\usepackage{listliketab}

\usepackage[english, japanese]{babel}

\usepackage{amsthm}

\newtheoremstyle{mystyle}{}{}{\normalfont}{}{\bfseries}{}{\newline}{}

\theoremstyle{mystyle}

\newtheorem{thm}{定理}[section]

\newtheorem*{thm*}{定理}

\newtheorem{prf}{証明}[section]

\newtheorem*{prf*}{証明}

\usepackage{bm}

\makeatletter

\renewcommand{\theequation}
{\arabic{section}.\arabic{equation}}

\@addtoreset{equation}{section}

\makeatother
%--^
¥chapter{いち} % 第1章
¥begin{figure} % 「図1」になっている
¥label{fig:a}
¥includegraphics{fig1.eps}
¥caption{figure 1}
¥end{figure}
ここで、
¥ref{fig:a} % と書くと「図1-1」と表示されてしまうが「図1」にしたい

epsの図が小さい

- 植田 晃央 の投稿
epsの図が小さく表示されます。
ログの表示に
** WARNING ** UCS-4 TrueType cmap table...
と出ているのが関係しているのでしょうか?

Beamer 表が3行以上表示できない

- 山田 太郎 の投稿
Beamerで表を使おうと試みたのですが、3行以上表示されず困っています。

¥begin{frame}
¥begin{table}[htb]
¥begin{tabular}{l|l|l}
Rank & Programing Language & Rating ¥¥ ¥hline¥hline
1 & Java & 21.145 ¥¥ ¥hline
2 & C & 15.594 ¥¥ ¥hline
3 & C++ & 6.907 ¥¥ ¥hline
¥end{tabular}
¥end{table}
¥end{frame}

これだとタイプセットできるのですが、

¥begin{frame}
¥begin{table}[htb]
¥begin{tabular}{l|l|l}
Rank & Programing Language & Rating ¥¥ ¥hline¥hline
1 & Java & 21.145 ¥¥ ¥hline
2 & C & 15.594 ¥¥ ¥hline
3 & C++ & 6.907 ¥¥ ¥hline
4 & C# & 12 ¥¥ ¥hline
¥end{tabular}
¥end{table}
¥end{frame}


.beamer.text:70:Illegal parameter number in definition of \test.
<to be read again>

l.70 \end{tabular}

?


こうするとこのようなエラーになります。
どなたか、お願いします




数式に日本語を綺麗にいれる方法

- XU Zijian の投稿
\[ \psi(x) = (位相) \times e^{-\alpha x^2} \]
のような式をきれいにいれたいです。
このままでは,「位相」という文字が他の文字に比べやや上に
上がっているので,これを他の英字の高さに揃えたいです。

ご存知の方がいらっしゃいましたらよろしくお願いします。
添付 1454858396190.jpg

バーの記号について

- 坂本 の投稿
 ド・モルガンの法則等で出てくる $ ¥overline{A ¥cap B} $ で、 これを ¥boldmath にした場合、バーだけはボールド体になりません。数学記号ではないので当然ですが、これをうまく処理する方法はないものでしょうか。無理なのか、その他の手があるのか分かりましたらお教え頂けないでしょうか。

Beamerでcolumnを使用するとエラーが出ます

- 山田 太郎 の投稿
Beamerを使用し以下のように記述するとエラーが出てしまいます。原因がわからず困っています。

----------------------------------------------------------------------
¥documentclass[dvipdfmx]{beamer}
¥begin{document}
¥section{タイトル}
¥begin{frame}{タイトル}
¥begin{columns}[c]
¥begin{column}{0.4¥textwidth}
 ¥begin{itemize}
 ¥item 「AAA」 
¥end{column}
¥begin{column}{0.6¥textwidth}
 ¥begin{itemize}
 ¥item 「BBB」
 ¥end{itemize}
¥end{column}
¥end{columuns}
¥end{frame}
¥end{document}

--------------------------------------------------------------------------
エラー内容は以下の通りです

--------------------------------------------------------------------------
Runaway argument?
\left \AtEnddocument \@fistofone \@enddocumenthook \@checkend
{docume\ETC.
! File ended while scanning use of \beamer@collect@@body
<inserted text>
 \par
<*> test

?

*
(Please type a command or say '\end')
*

-------------------------------------------------------------------------

Teashopを使用してます。自分自身Beamerを初めて使うのでわからないことだらけです。

ぜひよろしくお願いします。


LuaTeX-jaとlistingsのバグ?

- 大宮 貴史 の投稿
LuaTeX-jaとlistingsについての質問です。
環境はTeX Live 2015で2/1に更新したものです。
luatexja-fontspecの\setmainjfontと、
listingsのオプションのbasicstyleで\smallなどのフォントサイズを変更するオプションを用いると、
以下のエラーが発生するようです。
これはLuaTeX-jaのバグなのでしょうか?

! Missing number, treated as zero.
<to be read again>
=
l.14 \begin{lstlisting}

?

以下ソースコードです。ログも添付しておきます。

\documentclass{ltjsarticle}

\usepackage{luatexja-fontspec}
\setmainjfont{IPAexMincho}

\usepackage{listings}

\lstset{
  basicstyle=\small
}

\begin{document}

\begin{lstlisting}
  This is a \LaTeX.
\end{lstlisting}

\end{document}

LuaLaTeX (2016/02/01) で数式が化ける

- aminophen の投稿
以下のソースを,本日 tlmgr でアップデートした TeX Live 2015 環境で
lualatex を使ってタイプセットすると数式が化けます。
(化け方は添付画像のとおり)
LaTeX [2016/02/01] がインストールされた環境です。
OS X Lion (10.7.5) でも OS X El Capitan (10.11.3) でも報告されています。
# 以下,テストソース名が luatexja-test.tex となっているのは
# 最初 LuaTeX-ja のアップデートが原因かなと勘違いしていたため。

===== ソース =====
% luatexja-test.tex
\listfiles
\documentclass{article}
\begin{document}
\[
F(x)=a+b+c
\]
\end{document}
==========

===== ログ =====
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) 
 restricted \write18 enabled.
(./luatexja-test.tex
LaTeX2e <2016/02/01>
Babel <3.9n> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
(./luatexja-test.aux) [1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updm</div><div>ap/pdftex.map}] (./luatexja-test.aux)

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 ***********

)
 259 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 39 glue_spec, 1 write nodes
   avail lists: 1:1,2:12,3:11,4:40,5:1,6:17,7:1,9:8
<</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb><
</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on luatexja-test.pdf (1 page, 16833 bytes).
Transcript written on luatexja-test.log.
==========

原因はまだ調べておりませんが,現象の報告まで。
添付 lualatex-20160201.png