Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX: change defaults for admonition or code-block colors from white or black as currently used #10620

Open
jfbu opened this issue Jul 1, 2022 · 1 comment
Labels
builder:latex type:enhancement enhance or introduce a new feature
Milestone

Comments

@jfbu
Copy link
Contributor

jfbu commented Jul 1, 2022

I have tested some configuration, vaguely motivated to have about same colors for PDF rendering as in the default HTML theme, Alabaster.

My main motivation is for code-blocks where I feel the framing is distractive, and I feel a light grey background colour would be better. But I have not tested what it gives on printed paper.

Here is the configuration I tried (with the proposal to make it the default at 6.0.0). Mainly colors are changed and a few widths.

latex_elements = {
    'sphinxsetup': """%
  VerbatimColor={RGB}{230,230,230},%
  verbatimwithframe=false,
  verbatimsep=5pt,
%       shadowBorderColor={RGB}{102,102,102},% requires #10619
%       shadowShadowColor={RGB}{187,187,187},%
  shadowrule=2pt,%
  shadowsize=6pt,%
  noteBorderColor={RGB}{204,204,204},%
  hintBorderColor={RGB}{204,204,204},%
  importantBorderColor={RGB}{204,204,204},%
  tipBorderColor={RGB}{204,204,204},%
  noteborder=5pt,%
  hintborder=5pt,%
  importantborder=5pt,%
  tipborder=5pt,%
  warningBorderColor={RGB}{255,119,119},%
  cautionBorderColor={RGB}{255,119,119},%
  attentionBorderColor={RGB}{255,119,119},%
  dangerBorderColor={RGB}{255,119,119},%
  errorBorderColor={RGB}{255,119,119},%
  warningBgColor={RGB}{255,238,238},%
  cautionBgColor={RGB}{255,238,238},%
  attentionBgColor={RGB}{255,238,238},%
  dangerBgColor={RGB}{255,238,238},%
  errorBgColor={RGB}{255,238,238},%
  % LaTeX code of heavyboxes draws border "inwards" so
  % it must be not too big
  warningborder=3pt,%
  cautionborder=3pt,%
  attentionborder=3pt,%
  dangerborder=3pt,%
  errorborder=3pt,%
""",
}

edit: on second thoughts perhaps keeping verbatimsep=3pt which is current default (it is set to \fboxsep and the latter default to 3pt in LaTeX) is better than the 5pt tried out here

It renders like this (with #10619 merged):

foo-5

foo-6

(the comment about "automatic shift to next page" is too optimistic, it can happen that the unbreakable inner box will stay on first page because it is only one or two baselines too long, and as the frame is drawn latest, it will hide part of the overflowing contents, which can be a problem if the frame is thick enough; alas, one never ends encountering problems with pagebreaks versus boxes in LaTeX...)

foo-7

foo-8

foo-9

project is attached (can be compiled without #10619, some commented things should be uncommented to exploit it)
testnewdefaults.zip

@jfbu jfbu added type:enhancement enhance or introduce a new feature builder:latex labels Jul 1, 2022
@jfbu jfbu added this to the 6.0.0 milestone Jul 1, 2022
@AA-Turner AA-Turner modified the milestones: 6.0.0, 6.1.0 Oct 16, 2022
@jfbu
Copy link
Contributor Author

jfbu commented Oct 17, 2022

Regarding tables and code-blocks, #10924 is now merged. For warning and like admonitions, the longstanding plain default rendering has been kept so far (because I am undecided on what would a good design; PRs most welcome!)

@AA-Turner AA-Turner modified the milestones: 6.1.0, 6.0.0 Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builder:latex type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants