sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.41k stars 2.09k forks source link

LaTeX representation for :class: (of like `..code-block::` or `..note::`) #4010

Open k16shikano opened 7 years ago

k16shikano commented 7 years ago

Subject: Feature Request.

Problem

Some directives take :class:, but they are simply ignored in LaTeX outputs. It would be nice if we could get corresponding outer LaTeX environments having the name of the :class:. Then we should be able to define the environments in .sty to achieve different styles based on each :class:es.

Example to reproduce the problem

.. ::note
    :class: foo

    Some texts...

.. ::note
    :class: bar

    Other texts...

Error logs / results

\begin{sphinxadmonition}{note}
Some texts...
\end{sphinxadmonition}

\begin{sphinxadmonition}{note}
Other texts...
\end{sphinxadmonition}

Expected results

\begin{foo}
\begin{sphinxadmonition}{note}
Some texts...
\end{sphinxadmonition}
\end{foo}

\begin{bar}
\begin{sphinxadmonition}{note}
Other texts...
\end{sphinxadmonition}
\end{bar}

My suggestion is to be able to let users define their own styles in LaTeX based on :class: as in HTMLs.

cf. In HTML, we get results something like below;

<div class="foo admonition note">
Some texts...
</div>

<div class="bar admonition note">
Other texts...
</div>

We might want to have an explicit command line option to enable this feature, since such an outer LaTeX environment must cause errors when make PDF from the LaTeX files without appropriate \newenvironment.

tk0miya commented 7 years ago

+1 for this idea. I think this would be helpful and useful for users who want to customize the LaTeX styles. But it also harms users who want to customize only HTML output if we introduce simply. So I would like to add some options to enable the feature.

Any ideas or objections?

anotherbridge commented 3 months ago

Are there any updates or plans on this issue?

I am facing the same and were wondering whether there is any progress or if it's already usable and just needs to be enabled?