0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LaTeXで①やⒶのような丸囲み文字を出力する方法

Posted at

はじめに

LaTeXで「①」や「Ⓐ」のような丸囲み文字を使いたいことがあるが、これらを直接入力するとコンパイルエラーになる場合がある。
そこで、自作コマンドで安定して丸囲み文字を出力する方法を紹介する。

以下のように出力できるようになる。

!

まず、プリアンブルに次の設定を追加する。

\newcommand{\circledtext}[1]{\leavevmode\raise0.2ex\hbox{\textcircled{\scriptsize #1}}}

使い方

文中で次のように記述すると、丸囲み文字を出力できる。

\circledtext{1}  
\circledtext{12}  
\circledtext{A}  
\circledtext{}  
\circledtext{}

数字・アルファベット・ひらがな・漢字など幅広く対応しているが、数字は2桁、それ以外は1文字までが推奨である。

解説

  • \newcommandで新しいコマンド\circledtext{}を定義している。
  • \leavevmodeは段落の先頭でも安全に動作させるためのもの。これがないとエラーになる場合がある。
  • \raise0.2exは文字の位置を少し上にずらし、丸の中心と文字をきれいに合わせる。
  • \scriptsizeは囲まれる文字を小さくして、丸の中に収める。
  • \hboxは囲まれた内容を1つのボックスとして扱う。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?