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

Disable background colour #69

Open
Atcold opened this issue Mar 3, 2023 · 9 comments
Open

Disable background colour #69

Atcold opened this issue Mar 3, 2023 · 9 comments

Comments

@Atcold
Copy link

Atcold commented Mar 3, 2023

There is no obvious way to turn off the background colour (i.e. setting it to transparent).

@u-fischer
Copy link

backgroundcolor=none should work.

@Atcold
Copy link
Author

Atcold commented Oct 31, 2024

main.tdo: error: 17: Package xcolor Error: Undefined color `none'. ...) diagrams, 3) plotting.}{145}{section*.4}

@u-fischer
Copy link

works fine here on texlive 2024:

\documentclass{article}

\usepackage{todonotes}

\begin{document}

xxx\todo[backgroundcolor=none]{hallo}
\end{document}

image

@Atcold
Copy link
Author

Atcold commented Nov 1, 2024

Okay, I should have been clearer. Apologies for the back and forth.
Specifying backgroundcolor=none in \setuptodonotes{} will issue an Undefined color `none'.

@mbertucci47
Copy link

This works fine for me:

\documentclass{article}

\usepackage{todonotes}

\setuptodonotes{backgroundcolor=none}

\begin{document}

xxx\todo{hallo}
\end{document}

@FrankMittelbach
Copy link

@Atcold looks like you have an old or broken setup. Add \listfiles[sizes]in your example doc and compare the result to the list I get to figure out what is different in your setup.

LaTeX2e <2024-06-01> patch level 2
L3 programming layer <2024-10-09>
 ***********


 *File List*
 article.cls    2024/02/08 v1.4n Standard LaTeX document class
    (size 20144)
  size10.clo    2024/02/08 v1.4n Standard LaTeX file (size option)
    (size 8448)
todonotes.sty    2024/01/05
    (size 21404)
  ifthen.sty    2024/03/16 v1.1e Standard LaTeX ifthen package (DPC)
    (size 5525)
 xkeyval.sty    2022/06/16 v2.9 package option processing (HA)
    (size 4937)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
    (size 19231)
  xcolor.sty    2024/09/29 v3.02 LaTeX color extensions (UK)
    (size 55384)
   color.cfg    2016/01/02 v1.6 sample color configuration
    (size 1213)
  pdftex.def    2024/04/13 v1.2c Graphics/color driver for pdftex
    (size 19440)
mathcolor.ltx
    (size 2885)
    tikz.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 339)
     pgf.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 1090)
  pgfrcs.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 325)
pgfrcs.code.tex
    (size 4385)
 pgfcore.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 373)
graphicx.sty    2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
    (size 8010)
graphics.sty    2024/05/23 v1.4g Standard LaTeX Graphics (DPC,SPQR)
    (size 18363)
    trig.sty    2023/12/02 v1.11 sin cos tan (DPC)
    (size 4023)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
    (size 1224)
  pgfsys.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 443)
pgfsys.code.tex
    (size 61351)
pgfsyssoftpath.code.tex    2023-01-15 v3.1.10 (3.1.10)
    (size 7778)
pgfsysprotocol.code.tex    2023-01-15 v3.1.10 (3.1.10)
    (size 1896)
pgfcore.code.tex
    (size 1016)
pgfcomp-version-0-65.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 21013)
pgfcomp-version-1-18.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 989)
  pgffor.sty    2023-01-15 v3.1.10 (3.1.10)
    (size 348)
 pgfkeys.sty    
    (size 274)
pgfkeys.code.tex
    (size 39784)
 pgfmath.sty    
    (size 306)
pgfmath.code.tex
    (size 949)
pgffor.code.tex
    (size 24033)
tikz.code.tex
    (size 186782)
    calc.sty    2023/07/08 v4.3 Infix arithmetic (KKT,FJ)
    (size 10214)
l3backend-pdftex.def    2024-05-08 L3 backend support: PDF output (pdfTeX)
    (size 29785)
supp-pdf.mkii
    (size 71627)
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
    (size 13886)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
    (size 678)
 ***********

@Atcold
Copy link
Author

Atcold commented Nov 6, 2024

OMG, @FrankMittelbach!!! 🤯 I'm reading your book! 🔥 I love it! 😍

Small book feedback In section 1.3.2, Typographic conventions, you never mention there are sections typeset in smaller font, like section 2.3.8. I guess you meant that those sections are advanced? uninportant? skippable?

I should have isolated the bug and provided a MWE. It's my bad. Thanks, @mbertucci47, for indirectly suggesting it.
The following code will consistently break on the latest setup.

\documentclass{article}
\usepackage[colorinlistoftodos]{todonotes}
% \usepackage{todonotes}  % <-- this one actually works
\setuptodonotes{backgroundcolor=none}
\begin{document}

  xxx\todo{hallo}
  \listoftodos

\end{document}

The error is the following:

todo.tdo: error: 1: Package xcolor Error: Undefined color `none'. ...k}{none}{\textcolor {none}{o}}\ hallo}{1}{}

My current setup is the following.

Show setup

LaTeX2e <2024-11-01>
L3 programming layer <2024-10-09>
 ***********

File List
article.cls 2024/06/29 v1.4n Standard LaTeX document class
(size 20144)
size10.clo 2024/06/29 v1.4n Standard LaTeX file (size option)
(size 8448)
todonotes.sty 2024/01/05
(size 21404)
ifthen.sty 2024/03/16 v1.1e Standard LaTeX ifthen package (DPC)
(size 5525)
xkeyval.sty 2022/06/16 v2.9 package option processing (HA)
(size 4937)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
(size 19231)
xcolor.sty 2024/09/29 v3.02 LaTeX color extensions (UK)
(size 55384)
color.cfg 2016/01/02 v1.6 sample color configuration
(size 1213)
pdftex.def 2024/04/13 v1.2c Graphics/color driver for pdftex
(size 19440)
mathcolor.ltx
(size 2885)
tikz.sty 2023-01-15 v3.1.10 (3.1.10)
(size 339)
pgf.sty 2023-01-15 v3.1.10 (3.1.10)
(size 1090)
pgfrcs.sty 2023-01-15 v3.1.10 (3.1.10)
(size 325)
pgfrcs.code.tex
(size 4385)
pgfcore.sty 2023-01-15 v3.1.10 (3.1.10)
(size 373)
graphicx.sty 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
(size 8010)
graphics.sty 2024/08/06 v1.4g Standard LaTeX Graphics (DPC,SPQR)
(size 18363)
trig.sty 2023/12/02 v1.11 sin cos tan (DPC)
(size 4023)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
(size 1224)
pgfsys.sty 2023-01-15 v3.1.10 (3.1.10)
(size 443)
pgfsys.code.tex
(size 61351)
pgfsyssoftpath.code.tex 2023-01-15 v3.1.10 (3.1.10)
(size 7778)
pgfsysprotocol.code.tex 2023-01-15 v3.1.10 (3.1.10)
(size 1896)
pgfcore.code.tex
(size 1016)
pgfcomp-version-0-65.sty 2023-01-15 v3.1.10 (3.1.10)
(size 21013)
pgfcomp-version-1-18.sty 2023-01-15 v3.1.10 (3.1.10)
(size 989)
pgffor.sty 2023-01-15 v3.1.10 (3.1.10)
(size 348)
pgfkeys.sty
(size 274)
pgfkeys.code.tex
(size 39784)
pgfmath.sty
(size 306)
pgfmath.code.tex
(size 949)
pgffor.code.tex
(size 24033)
tikz.code.tex
(size 186782)
calc.sty 2023/07/08 v4.3 Infix arithmetic (KKT,FJ)
(size 10214)
l3backend-pdftex.def 2024-05-08 L3 backend support: PDF output (pdfTeX)
(size 29785)
supp-pdf.mkii
(size 71627)
epstopdf-base.sty 2020-01-24 v2.11 Base part for package epstopdf
(size 13886)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
(size 678)


@FrankMittelbach
Copy link

OMG, @FrankMittelbach!!! 🤯 I'm reading your book! 🔥 I love it! 😍

Not just mine, but thanks ... please spread the word, e.g. with a review -- too few people care or know about good books these days (to get you even minimal wages when write one like TLC3)

Small book feedback
In section 1.3.2, Typographic conventions, you never mention there are sections typeset in smaller font, like section 2.3.8. I guess you meant that those sections are advanced? uninportant? skippable?

True, could have been mentioned there too. It is mentioned on page 51 in a footnote:

1 The whole section is set in a smaller font to indicate that is more a reference — helpful mainly when studying existing code.


Now to your problem. The \listfiles shows no difference and my run works while yours doesn't ... so the difference was actually in me using pdftex and you probably luatex, because there it breaks.

So looks like a problem with xcolor when used with the Unicode engines. @u-fischer any thoughts?

@u-fischer
Copy link

u-fischer commented Nov 6, 2024

So looks like a problem with xcolor when used with the Unicode engines. @u-fischer any thoughts?

No, it has nothing to do with unicode engines. The problem is that tikz knows the "none" color, but (x)color does not.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\textcolor{red}{blub} %works
%\textcolor{none}{blub} % errors
\tikz{\draw[fill=red](0,0) rectangle (1,1)};  %works
\tikz{\draw[fill=none](0,0) rectangle (1,1)}; %works 
 
\end{document}

With the [colorinlistoftodos] option, todonotes tries to use the background color also in the list of todos. It then produce this contentsline which fails:

\contentsline {todo}{\fcolorbox {black}{none}{\textcolor {none}{o}}\ hallo}{1}{}%

todonotes could add support for the none color here e.g. like this

\documentclass{article}
\usepackage[colorinlistoftodos]{todonotes}
% \usepackage{todonotes}  % <-- this one actually works

\makeatletter
\newcommand*\@todonotes@colornone{none}
\renewcommand{\@todonotes@addElementToListOfTodos}{%
    \if@todonotes@colorinlistoftodos%        
        \addcontentsline{tdo}{todo}{%
         \ifx\@todonotes@colornone\@todonotes@currentbackgroundcolor
          \fbox{\phantom{o}}%
         \else 
          \fcolorbox{\@todonotes@currentbordercolor}%
             {\@todonotes@currentbackgroundcolor}%
             {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
         \fi    
            \ \@todonotes@caption}%
    \else%
        \addcontentsline{tdo}{todo}{\@todonotes@caption}%
    \fi}%
\makeatother      
\begin{document}
\listoftodos

\setuptodonotes{backgroundcolor=none}
xxx\todo{hallo}
 
\setuptodonotes{backgroundcolor=blue}
xxx\todo{hallo} 

\end{document}

![image](https://github.com/user-attachments/assets/86439e0a-2b65-4de9-bd2f-2b26839e83b0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants