看看这个小代码:
\documentclass{abntex2}
\usepackage{xwatermark}
\begin{document}
Testing 1 2 3
\end{document}
在使用最新的 MiKTeX 发行版运行时,TexnicCenter 2.02(64 位)会产生以下错误:
Command \framed already defined
Command \shaded already defined
Command \leftbar already defined
Command \snugshade already defined
Extra \endgroup
有人知道为什么会发生这种情况以及如何解决吗?
注意:我在 Overleaf 中运行了代码,没有显示任何错误。
答案1
尝试过以下解决方案此链接建议来自菲利佩·奥莱尼克但都导致错误。解决方案:删除 xwatermark 并将其替换为 draftwatermark(在 TexnicCenter 中编译时没有错误):
\documentclass{abntex2}
\usepackage{draftwatermark}
\SetWatermarkText{Draft}
\DraftwatermarkOptions{
color={[gray]0.5},
angle=45,
hpos=0.5\paperwidth,vpos=0.5\paperheight,
scale=5
}
\begin{document}
Testing 1 2 3
\end{document}
答案2
以下示例使用eso-pci并tikz
创建一些水印。
Tikz
用于创建不透明度的文本,但也可用于插入图像(例如tikz-我们之中)
下面的示例应用了一些可用来制作的水印变体eso-pic
。
\documentclass{abntex2}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{eso-pic}
\usepackage{graphicx}
\usetikzlibrary{calc}
% -----------------------------------------
% Boxes with translucent texts
% -----------------------------------------
\newsavebox\myboxr\savebox\myboxr{\tikz[color=red!80 ,opacity=0.4]\node{\huge{\textbf{red}}};}
\newsavebox\myboxo\savebox\myboxo{\tikz[color=orange!80 ,opacity=0.4]\node{\huge{\textbf{orange}}};}
\newsavebox\myboxy\savebox\myboxy{\tikz[color=yellow!90!black ,opacity=0.4]\node{\huge{\textbf{yellow}}};}
\newsavebox\myboxg\savebox\myboxg{\tikz[color=green!80!black!80,opacity=0.4]\node{\huge{\textbf{green}}};}
% -----------------------------------------
% FrontGround and BackGround watermarks
% -----------------------------------------
\AddToShipoutPictureFG{%
\AtTextUpperLeft{\put(0,-250){\scalebox{10}{\rotatebox{45}{\usebox\myboxr}}}}%
\AtPageCenter{\put(-280,-210){\scalebox{5}{\rotatebox{30}{\usebox\myboxy}}}}%
\AtStockLowerLeft{\put(250,150){\scalebox{5}{\rotatebox{90}{\color{blue}{blue}}}}}%
}
\AddToShipoutPictureBG{%
\AtTextUpperLeft{\put(-70,-200){\scalebox{10}{\rotatebox{-45}{\usebox\myboxo}}}}%
\AtPageCenter{\put(-100,50){\scalebox{7}{\rotatebox{-30}{\usebox\myboxg}}}}%
\AtStockLowerLeft{\put(420,350){\scalebox{5}{\rotatebox{-90}{\color{violet}{violet}}}}}%
}
\begin{document}
\includegraphics{example-image-a}
\lipsum[66]
\includegraphics{example-image-b}
\end{document}
结果如下: