Tips-pythontex
pythontex
Tex コード中に python コードを埋め込む
https://texwiki.texjp.org/?PythonTeX
インストール
TexLive をインストールしている場合にはインストールされている
python 側では pip3 install pygments が必要
使い方(上記のURLから)
以下の TeXコード test00.tex でつくり
\documentclass{article} \usepackage{pythontex} \newcommand{\pow}[2]{\py{#1**#2}} \begin{document} $2^{10}=\pow{2}{10}$. \end{document}
を
platex test00.tex python3 /usr/bin/pythontex test00 platex test00.tex dvipdfmx test00.dvi
でPDF化する
test00.pythoncode というファイルが作成され
再度TeXで変換する