Rmarkdownからknitする際\newcommandを使えるようにする
r-wakalangでatusyさんに教えていただいたのでこちらにまとめます。
Rmarkdownで論文を書いている際、こちらのように数式内に下付きの$argmax$を使いたかったのですが、なかなかできませんでした。
教えてくれた答えはシンプルで、本文中に記載するというもの。ただし、
\newcommand{\argmax}{\mathop{\rm arg~max}\limits}
のなかの\rm
が古いので\mathrm
とするだけ。
解決策
本文中に以下のチャンクを追加する。
cat(sprintf(
"\\%snewcommand{\\argmax}{\\mathop{\\mathrm arg~max}\\limits}",
if (knitr::is_latex_output()) "re" else ""
))
数式をかいて
$\argmax_{a} f(x)$
Author And Source
この問題について(Rmarkdownからknitする際\newcommandを使えるようにする), 我々は、より多くの情報をここで見つけました https://qiita.com/naru-T/items/d5bbbe09bd6703708933著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .