sphinx-panels icon indicating copy to clipboard operation
sphinx-panels copied to clipboard

Formatting in LaTeX output

Open chrisjsewell opened this issue 5 years ago • 5 comments

All the nodes used are nodes.container which do not have any special formatting in LaTeX output, so all the content in panels/dropdown directive will just show "as is". At a minimum, we could wrap each panel in the sphinxadmonition environments, as done for admonitions: https://github.com/sphinx-doc/sphinx/blob/f0df9ac7254bc0fed85c765fd13dcd1bf8718a58/sphinx/writers/latex.py#L1357-L1363

chrisjsewell avatar May 04 '20 17:05 chrisjsewell

Hi @chrisjsewell as you write, panels are wrapped in sphinxadmonitions and this is fine. There is a problem however with badges, which in lates are rendered with e.g., \DUrole{sphinx-bs,badge,badge-primary,badge-pill}. This makes it (AFAIK) impossible to use \renewcommand to customise the output, which is rendered as plain text. Do you have any plan to change or fix this behavious? Thanks!

stefanodavid avatar Jul 09 '20 09:07 stefanodavid

Hey @stefanodavid yes I haven't had time to do too much testing of the latex outputs thus far I'm afraid. I'm certainly open to improvements, did you have any suggestions on what the correct rendering should be?

chrisjsewell avatar Jul 09 '20 10:07 chrisjsewell

Hi @chrisjsewell thanks for the prompt reply. As mentioned, the problems I found in my today's tests are:

  • a dash - in the role name
  • multiple roles in a same \DUrole's curly brace.

They prevent an easy \renewcommand of the role, so all badge-related (LaTeX) role can not be customised in Latex. My best suggestion (although limited) would be to render any :badge:test, bg-primary as either \DUrole{badgeprimary}{test} (best) or \DUrole{badge}[primary]{test}, stripping any other classes badge-pill. In this way I could use something like \renewcommand{\DUrolebadgeprimary}{\tcbox[colback=blue, coltext=white]{test}} to render the badge quite like the HTML version.

stefanodavid avatar Jul 09 '20 11:07 stefanodavid

Hi @chrisjsewell, I just had the chance to try out the new tabbed directive, which is great, and I noticed that in LaTeX output the directive's title becomes a rubric. Just an idea, but what about making the same for dropdown directives? Or even better, why not add an option to render it (or both) as a custom directive (e.g., topic, a info/warning/important admonition or similar)?

stefanodavid avatar Oct 23 '20 07:10 stefanodavid

yep that sounds possible thanks 👍

chrisjsewell avatar Oct 23 '20 11:10 chrisjsewell