![当可选注释参数与 changes.sty 命令一起使用时,自定义颜色会失败](https://linux22.com/image/461970/%E5%BD%93%E5%8F%AF%E9%80%89%E6%B3%A8%E9%87%8A%E5%8F%82%E6%95%B0%E4%B8%8E%20changes.sty%20%E5%91%BD%E4%BB%A4%E4%B8%80%E8%B5%B7%E4%BD%BF%E7%94%A8%E6%97%B6%EF%BC%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%9C%E8%89%B2%E4%BC%9A%E5%A4%B1%E8%B4%A5.png)
我定义了一个自定义颜色,用于跟踪更改包changes.sty
。效果很好除了当我向命令的可选参数添加注释参数时。
有人可以确认存在这种行为并提出解决方法吗?
MWE 是:
\documentclass[14pt]{extarticle}
\usepackage[margin=1.0in]{geometry}
\usepackage{color}
\definecolor{darkgreen}{rgb}{0.0,0.6,0.1} % Custom colour
\usepackage{changes}
\definechangesauthor[color=magenta]{AA}
\definechangesauthor[color=darkgreen]{BB} % Author BB uses custom colour
\begin{document}
% No comment or custom colour: WORKS FINE
Quick \added[id=AA]{brown} fox jumped.
% Comment but no custom colour: WORKS FINE
Quick \added[id=AA,comment={Not red}]{brown} fox jumped.
% No comment or custom colour: WORKS FINE
Quick \added[id=BB]{brown} fox jumped.
% Comment and custom colour: GENERATES ERROR (Line 19)
Quick \added[id=BB,comment={Not red}]{brown} fox jumped.
% ! Package xcolor Error: Undefined color model `'.
%
% See the xcolor package documentation for explanation.
% Type H <return> for immediate help.
% ...
%
% l.19 Quick \added[id=BB,comment={Not red}]{brown}
% fox jumped.
\end{document}
附言我尝试通过为注释参数提供较宽的边距来美化示例,但changes.sty
似乎没有使用这些边距。在 PDF 文档中搜索“宽度”没有找到任何我认识的参数,用于控制包含注释的边距气球的宽度。
答案1
更改包加载xcolor
,因此颜色按照此包的语法进行处理。但是您在包的语法中定义了颜色color
,这让人感到困惑xcolor
。要么加载 xcolor 而不是 color,要么将您的定义移到changes
包后面:
\documentclass[14pt]{extarticle}
\usepackage[margin=1.0in]{geometry}
\usepackage{changes}
\definecolor{darkgreen}{rgb}{0.0,0.6,0.1} % Custom colour
\definechangesauthor[color=magenta]{AA}
\definechangesauthor[color=darkgreen]{BB} % Author BB uses custom colour
\begin{document}
% No comment or custom colour: WORKS FINE
Quick \added[id=AA]{brown} fox jumped.
% Comment but no custom colour: WORKS FINE
Quick \added[id=AA,comment={Not red}]{brown} fox jumped.
% No comment or custom colour: WORKS FINE
Quick \added[id=BB]{brown} fox jumped.
Quick \added[id=BB,comment={Not red}]{brown} fox jumped.
\end{document}