
次のように、ボックス内に色付きのインライン Python コードをレポートに追加しようとしています。
ご覧のとおり、「マトリックス テキストは赤色でボックスに埋め込まれています」。次の方法を使用してインライン カラー コードを追加できます。
CVXOPT extends the built-in Python objects with two matrix objects: a {\color{red}\texttt{matrix}} object for dense
コードの周囲にボックスがある以外はほぼ完璧です。 コードの周囲にボックスを配置するにはどうすればよいでしょうか?
答え1
\fbox{...}
単に:の中に入れることができます。
\documentclass[border=5pt]{standalone}
\usepackage{xcolor}
\newcommand{\pyobject}[1]{\fbox{\color{red}{\texttt{#1}}}}
\begin{document}
CVXOPT extends the built-in Python objects with two matrix objects: a \pyobject{matrix} object for dense
\end{document}
\ovalbox{...}
または、角を丸くしたい場合は、fancybox
パッケージ:
\documentclass[border=5pt]{standalone}
\usepackage{xcolor,fancybox}
\newcommand{\pyobject}[1]{\ovalbox{\color{red}{\texttt{#1}}}}
\begin{document}
CVXOPT extends the built-in Python objects with two matrix objects: a \pyobject{matrix} object for dense
\end{document}