2

I read the xcolor documentation and I understood that . is a placeholder for the current text color. How can I get the current background color?

ps: The final purpose of this is to temporarily hide a text; for example if .. is a placeholder for the current background color, I could use \colorlet{tmp}{.}\color{..}#1\color{tmp}.

TobiBS
  • 5,240
Moïse
  • 21
  • There isn't a 'current background' in TeX terms: are you perhaps using beamer? – Joseph Wright Aug 24 '20 at 12:59
  • No I am not using beamer. I just need to sometimes hide parts of a document. I can't use \phantom because it is incompatible with lists (itemize & enumerate). – Moïse Aug 24 '20 at 13:07
  • 1
    by default there is no background color at all. You can add one with \pagecolor{somecolor} (and then you would know the color). Beside this: setting the color of text doesn't really hide it, it can still be copy&pasted from the file. – Ulrike Fischer Aug 24 '20 at 13:23
  • 1
    Plus there could be colour boxes or stuff overlaying stuff: really, 'this won't work' – Joseph Wright Aug 24 '20 at 13:26
  • @ JosephWright "setting the color of text doesn't really hide it, it can still be copy&pasted from the file." I know that but I don't have better idea. As I said, phantom simply don't work at all with itemize: a code as simple as \phantom{\begin{itemize}\item test\end{itemize}} make an error (I am beginning to think that LaTeX is mainly a tricks & hacks language ;) ).If you have another idea for a better hiding, feel free to share it, I will be happy to use it. Thanks – Moïse Aug 24 '20 at 16:38
  • I already told you in your other question: the best way to hide text completly is to use lualatex and the lua-ul package. If you don't care about copy&paste then you can also use the transparent package. See https://tex.stackexchange.com/a/555681/2388. – Ulrike Fischer Aug 24 '20 at 17:30
  • I can't use LuaLatex (around 2 times slower for me so it's a no go because I need to compile very often + the tex files are shared, so it's complicated to change everybody config). I yet tried the transparent package but it seems to don't work at all on my config (the last version of this package is from 2007, maybe it is no more compatible with recent Miktex ?). Thanks for your help. – Moïse Aug 25 '20 at 13:42
  • You should correctly ping people if you want them to see your comments. The newest version of transparent is from 2019: [2019/11/29 v1.4 Transparency via pdfTeX's color stack (HO)]%, and it is also in a current miktex. If you have an outdated transparent version if can clash with tikz and so loose transparency. – Ulrike Fischer Aug 27 '20 at 08:12
  • @UlrikeFischer Thanks for you explanation, I am trying to learn: I definitively made a mistake about the version. But now I have the messages Loading aborted, because pdfTeX is not running in PDF mode and Undefined control sequence. \transparent: not sure if transparent package is compatible with XeLaTeX... – Moïse Aug 29 '20 at 21:56
  • no transparent doesn't work with xelatex, xelatex doesn't have the needed color stacks. But if you are using already an unicode engine, why it is so difficult for you to switch to lualatex? – Ulrike Fischer Aug 29 '20 at 21:59

0 Answers0