
私は、Sphinx から生成された LaTeX テーブルの外観を改善しようとしています。特に、booktabs の上、中、下のルールを使用し、垂直のセル区切りを抑制したいと考えています。
この rST テーブル:
+--------------+---+-----------+
| simple text | 2 | 3 |
+==============+===+===========+
| simple text | 2 | 3 |
+--------------+---+-----------+
| simple text | 2 | 3 |
+--------------+---+-----------+
次のように変換されます:
\begin{savenotes}\sphinxattablestart
\centering
\begin{tabulary}{\linewidth}[t]{JJJ}
\hline
\sphinxstyletheadfamily
simple text
&\sphinxstyletheadfamily
2
&\sphinxstyletheadfamily
3
\\
\hline
simple text
&
2
&
3
\\
\hline
simple text
&
2
&
3
\\
\hline
\end{tabulary}
\par
\sphinxattableend\end{savenotes}
次のように変換したいです:
\begin{savenotes}\sphinxattablestart
\centering
\begin{tabulary}{\linewidth}[t]{JJJ}
\toprule
\sphinxstyletheadfamily
simple text
&\sphinxstyletheadfamily
2
&\sphinxstyletheadfamily
3
\\
\toprule
simple text
&
2
&
3
\\
\midrule
simple text
&
2
&
3
\\
\bottomrule
\end{tabulary}
\par
\sphinxattableend\end{savenotes}
conf.py から booktabs を読み込むことができます。
現在のSphinxドキュメントはこちらhttps://www.sphinx-doc.org/en/master/latex.htmlこのレベルの制御は conf.py 経由では利用できないことを示唆していますが、ページの下部にはテンプレート経由のカスタマイズについて言及するメモがあります。
実験的な機能として、プロジェクトに _templates/latex.tex_t というファイルがある場合、Sphinx は LaTeX ソースにユーザー定義のテンプレート ファイルを使用できます。追加のファイル longtable.tex_t、tabulary.tex_t、tabular.tex_t を _templates/ に追加して、テーブル レンダリングのいくつかの側面 (キャプションの位置など) を設定できます。
そして、それを指すためのパラメータがあり、conf.py で次のように設定しています。
templates_path = '_templates'
テンプレートを追加しましたhttps://github.com/sphinx-doc/sphinx/tree/3.x/sphinx/templates/latex
テンプレートは読み込まれません。
質問:
- これはテンプレート経由で可能ですか? 可能であれば、どのようにすればよいですか? この機能は Sphinx 1.6 で実験的なものでしたが、削除された可能性があります。
- そうでない場合、プリアンブル、sty ファイルなどを介してブックタブを使用するようにテーブルを再定義する方法はありますか?
どうもありがとう。