Le 19/10/2019 à 00:27, Jeff Larson a écrit :
This is outstanding for Note admonitions. Is the same thing possible for the seealso directive? https://www.sphinx-doc.org/en/1.5/markup/para.html#directive-seealso
No, the styling by the LaTeX writer is minimal: def visit_seealso(self, node): # type: (nodes.Element) -> None self.body.append('\n\n\\sphinxstrong{%s:}\n\n' % admonitionlabels['seealso']) def depart_seealso(self, node): # type: (nodes.Element) -> None self.body.append("\n\n") It does not create a LaTeX environment which can be customized, the LaTeX file will contain only things like -----start of example Text before \sphinxstrong{See also:} This is contents of seealso directive Text after ----end of example and at time of LaTeX compilation to PDF it is impossible from current mark-up to see where the directive contents end. Clearly, the LaTeX writer support for "seealso" directive is deficient. I will create a ticket upstream. As a possible work-around : You can however use the following generic admonition mark-up (although maybe you don't want that for HTML output and may need usage of "only" directive which in the long run is too cumbersome) .. admonition:: See also: Un autre test In the LaTeX file, this inherits the customization of the "note" admonition. (which may be bad for you if you want another color for it). This is due to LaTeX writer doing this def visit_admonition(self, node): # type: (nodes.Element) -> None self.body.append('\n\\begin{sphinxadmonition}{note}') self.no_latex_floats += 1 You see that a generic admonition directive falls back to "note" type. Hence it appears impossible to customize it differently on LaTeX side from the note admonition type (apart from hooking into the Python code) And there is a difference: for a "note" admonition, LaTeX mark-up ends up being like \begin{sphinxadmonition}{note}{Note:} This is a test \end{sphinxadmonition} for a generic admonition such as above, it ends up like this in LaTeX file \begin{sphinxadmonition}{note}{See also:} Un autre test \end{sphinxadmonition} And thus in PDF output, "See also:" will stand on its own line in contrast to "Note:" which does not insert a linebreak after it. These peculiarities are a legacy situation... I don't have good explanation or rationale for it. -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/qoelng%247t62%241%40blaine.gmane.org.