Last active
July 10, 2025 12:31
-
-
Save zr-tex8r/46759670e0d2a6aa26f0595f27f2bbef to your computer and use it in GitHub Desktop.
イマドキの生成AIのTeXプログラミングを添削する④
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ProvidesExplPackage {ai-coding-4} {2025-07-07} {0.1} | |
{NabeAzz by AI coding} | |
\RequirePackage{xparse} | |
%=============== フォント定義 =============== | |
% Computer Modern Funny Italic (cmfi10) を OT1/cmfr/m/it に割り当て | |
\DeclareFontFamily{OT1}{cmfr}{} | |
\DeclareFontShape{OT1}{cmfr}{m}{it}{<-> cmfi10}{} | |
%=============== マクロ定義 =============== | |
\NewDocumentCommand{\NabeAzz}{ m } | |
{ | |
\int_step_inline:nn { #1 } | |
{ | |
\int_compare:nF { ##1 == 1 } { ~ } | |
\exp_args:Ne \str_if_in:nnTF { \int_to_arabic:n {##1} } { 3 } | |
{ \bool_set_true:N \l_tmpa_bool } | |
{ \bool_set_false:N \l_tmpa_bool } | |
\bool_if:nTF | |
{ | |
( \int_compare_p:n { \int_mod:nn { ##1 } { 3 } == 0 } ) | |
|| | |
\l_tmpa_bool | |
} | |
{ | |
{ \large \usefont{OT1}{cmfr}{m}{it} \int_to_arabic:n {##1} } | |
} | |
{ | |
\int_to_arabic:n {##1} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
説明
入力
以下の動作を行うTeX言語のマクロ
\NabeAzz
を作れ。\NabeAzz{<整数n>}
は1からnまでの整数の十進表記を順に空白区切りで出力する。ただし、整数が「3の倍数である」または「(その十進表記に)数字3を含む」場合は、フォントを「Computer Modern Funny Italic」でサイズを\large
に変えて出力する。その他の条件は以下の通り。<整数n>
は正であり、かつ数字列で与えられると仮定してよい。想定外の引数を与えた場合の動作は何も規定しない。cmfi10
である。LaTeX では「エンコーディングOT1
、ファミリcmfr
、シリーズm
、シェープit
」に割り当てられている。