对于以下代码,我在使用 TexLive 的 Ubuntu 20.04 和 Ubuntu 22.04 中没有得到相同的结果。
\documentclass{article}
\usepackage[left=2.00cm, right=3.00cm, top=4.00cm, bottom=3.00cm,showframe]{geometry}
\usepackage{pstricks-add}
\usepackage{tikz}
\newlength{\pssize}\setlength{\pssize}{1cm}
\newcommand{\logotextformat}{\sffamily \bfseries \large}
\newcommand{\logoimg}[2]{
\begin{pspicture}(#1,-#2)
\newrgbcolor{curcolor}{0.88 0.15 0.11}
\psset{
unit=0.7pt,
linestyle=none,
fillstyle=solid,
fillcolor=curcolor
}
\pscustom{
\newpath
\moveto(74, 18)
\lineto(56, 18)
\lineto(56, 12)
\lineto(68, 12)
\lineto(68, 12)
\curveto(67, 7)(63, 5)(57, 5)
\curveto(50, 5)(45, 10)(45, 17)
\curveto(45, 24)(50, 30)(57, 30)
\curveto(63, 30)(67, 27)(69, 23)
\lineto(74, 25)
\curveto(71, 32)(65, 35)(57, 35)
\curveto(47, 35)(39, 27)(39, 17)
\curveto(39, 7)(47, 0)(57, 0)
\curveto(62, 0)(66, 2)(69, 5)
\lineto(69, 1)
\lineto(74, 1)
\lineto(74, 17)
\lineto(74, 17)
\lineto(74, 17)
\closepath
}
\pscustom{
\newpath
\moveto(27, 61)
\lineto(5, 61)
\lineto(5, 75)
\lineto(0, 75)
\lineto(0, 42)
\lineto(5, 42)
\lineto(5, 56)
\lineto(27, 56)
\lineto(27, 42)
\lineto(33, 42)
\lineto(33, 75)
\lineto(27, 75)
\closepath
}
\end{pspicture}
}
\newcommand{\placelogo}[2]{% \logo{<left>}{<top>}
\begin{tikzpicture}[remember picture,overlay, align=center,]
\node(logo) at ([xshift=#1, yshift=-#2] current page.north west)
[anchor=north west] {\logoimg{#1}{#2}};
\end{tikzpicture}\vspace*{-\baselineskip}}
\begin{document}
\placelogo{2cm}{3cm}
\end{document}
建造
我使用以下方式构建项目
latexmk -xelatex test.tex
TeX 3.14159265(TeX Live 2019/Debian)
徽标如预期般清晰可见。
TeX 3.141592653(TeX Live 2022/dev/Debian)
未显示徽标。
答案1
考虑用 tikz 命令替换 pstricks 代码,因为你无论如何都在使用 tikz。我已经转录了徽标,见下文,使用如何通过简单的 TikZ 命令实现这一点?。以下输出由当前 TeX 发行版使用pdflatex
、xelatex
或其他方式生成,无需额外的命令行参数。
\documentclass{article}
\usepackage[left=2.00cm, right=3.00cm, top=4.00cm, bottom=3.00cm,showframe]{geometry}
\usepackage{tikz}
\newcommand{\logoimg}[2]{%
\begin{tikzpicture}[x=0.7pt,y=0.7pt]%\begin{pspicture}(#1,-#2)
\definecolor{curcolor}{rgb}{0.88,0.15,0.11} %\newrgbcolor{curcolor}{0.88 0.15 0.11}
%\psset{
% unit=0.7pt,
% linestyle=none,
% fillstyle=solid,
% fillcolor=curcolor
% }
\fill[curcolor] %\pscustom{\newpath
(74,18)%\moveto(74, 18)
-- (56,18)%\lineto(56, 18)
-- (56,12)%\lineto(56, 12)
-- (68,12)%\lineto(68, 12)
%-- (68,12)%\lineto(68, 12) again???
.. controls (67,7) and (63,5) .. (57,5)%\curveto(67, 7)(63, 5)(57, 5)
.. controls (50,5) and (45,10) .. (45,17)%\curveto(50, 5)(45, 10)(45, 17)
.. controls (45,24) and (50,30) .. (57,30)%\curveto(45, 24)(50, 30)(57, 30)
.. controls (63,30) and (67,27) .. (69,23)%\curveto(63, 30)(67, 27)(69, 23)
-- (74,25)% \lineto(74, 25)
.. controls (71,32) and (65,35) .. (57,35)%\curveto(71, 32)(65, 35)(57, 35)
.. controls (47,35) and (39,27) .. (39, 17)%\curveto(47, 35)(39, 27)(39, 17)
.. controls (39,7) and (47,0) .. (57,0)%\curveto(39, 7)(47, 0)(57, 0)
.. controls (62,0) and (66,2) .. (69,5)%\curveto(62, 0)(66, 2)(69, 5)
-- (69,1)%\lineto(69, 1)
-- (74,1)%\lineto(74, 1)
-- (74,17)%\lineto(74, 17)
%-- (74,17)%\lineto(74, 17) again???
%-- (74,17)%\lineto(74, 17) and again???
-- cycle%\closepath
;%}
\fill[curcolor]%\pscustom{\newpath
(27,61)%\moveto(27, 61)
-- (5,61)%\lineto(5, 61)
-- (5,75)%\lineto(5, 75)
-- (0,75)%\lineto(0, 75)
-- (0,42)%\lineto(0, 42)
-- (5,42)%\lineto(5, 42)
-- (5,56)%\lineto(5, 56)
-- (27,56)%\lineto(27, 56)
-- (27,42)%\lineto(27, 42)
-- (33,42)%\lineto(33, 42)
-- (33,75)%\lineto(33, 75)
-- (27,75)%\lineto(27, 75)
-- cycle%\closepath
;%}
\end{tikzpicture}%\end{pspicture}
}
\newcommand{\placelogo}[2]{% \logo{<left>}{<top>}
\begin{tikzpicture}[remember picture,overlay, align=center,]
\node(logo) at ([xshift=#1, yshift=-#2] current page.north west)
[anchor=south west] {\logoimg{#1}{#2}};
\end{tikzpicture}}
\begin{document}
\placelogo{2cm}{3.25cm}
\end{document}
答案2
以下是对两个字符进行简单排版的解决方案。您可以使用另一种格式来获得与您的(复杂)绘图相似的字符:
\documentclass{article}
\usepackage[left=2.00cm, right=3.00cm, top=4.00cm, bottom=3.00cm,showframe]{geometry}
\usepackage{tikz}
\definecolor{logocolor}{rgb}{0.88,0.15,0.11}
\newcommand\logotextformat{\fontsize{1cm}{1.1cm}\selectfont\sffamily\bfseries}
\newcommand\logoimg{%
\makebox(0,0){\logotextformat\sffamily\bfseries\Huge\tabcolsep0pt\tabular{ll}
\textcolor{logocolor}{H}\\[-12pt] &\textcolor{logocolor}{G}\endtabular}}
\newcommand\placelogo[2]{% \logo{<left>}{<top>}
\begin{tikzpicture}[remember picture,overlay, align=center,]
\node(logo) at ([xshift=#1, yshift=-#2] current page.north west)
[anchor=north west] {\logoimg};
\end{tikzpicture}\vspace*{-\baselineskip}}
\begin{document}
\placelogo{2.5cm}{2.5cm}
\end{document}