Jupyter ノートブックから LaTeX にエクスポートするためのカスタム テンプレートがあります。
((*- extends 'article.tplx' -*))
% Disable input cells
((* block input_group *))
((* endblock input_group *))
これは問題なく動作しますが、ノートブック内の Python コードが警告やエラーを生成することがありますが、これはノートブックでは役に立ちますが、エクスポートでは役に立ちません。たとえば、あるノートブックには次のブロックがあります。
{
"cell_type": "code",
"execution_count": 106,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\me\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:3: FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame) but in a future version of pandas this will be changed to expand=True (return DataFrame)\n",
" This is separate from the ipykernel package so we can avoid doing imports until\n"
]
}
],
"source": [
"# Some Python code using Pandas\n",
"df = d.join(df.mycol.str.extract((?P<foo>\\d)')\n",
")"
]
}
エクスポートするときにそのようなエラーを除外したいと思います。テンプレートに次の行を追加してみました。
% Hide Stderr output
((* block stream_stderr *))
((* endblock stream_stderr *))
ただし、対応するエラーが LaTeX 出力に表示されます。私は何を間違っていますか?