如何将此标志固定在\tiny尺寸中?

如何将此标志固定在\tiny尺寸中?

我希望设计一个可以适应不同字体大小的徽标,就像 一样\LaTeX。这是我当前的代码:

\documentclass{article}

\makeatletter
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{iftex}
\ifdefined\fontspec
    \newcommand{\PJLlogo@font}{\normalfont\fontspec{LinBiolinum_R.otf}\selectfont}
\else
    \PassOptionsToPackage{T1}{fontenc}
    \RequirePackage{fontenc}
    \newcommand{\PJLlogo@font}{\normalfont\fontfamily{LinuxBiolinumT-TLF}\selectfont}
\fi
\DeclareSymbolFont{PJLupright}{U}{zeur}{b}{n}
\DeclareMathSymbol{\PJLSigma}{\mathalpha}{PJLupright}{"06}

\providecommand*{\ProjLib}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}\j%
\kern-0.266em\raisebox{0.56em}{\scalebox{0.4}{\rotatebox{-10}{$\PJLSigma$}}}%
\kern-0.065em%
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}

\providecommand*{\ProjLibText}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}j%
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}
\makeatother

\begin{document}

\tiny \ProjLib
\normalsize \ProjLib
\Huge \ProjLib

\tiny \ProjLibText
\normalsize \ProjLibText
\Huge \ProjLibText

\end{document}

生成结果:

在此处输入图片描述

但是,从图片中可以很容易地看出,徽标的\tiny尺寸似乎相当不合理。(我不确定这是否与长度单位的行为有关em。)我该如何解决这个问题?

答案1

您不想使用字距调整,而是要堆叠两个符号。

在提出我的解决方案之前,先说一些评论。

  1. 切勿使用\fontspec;而是定义一个\newfontface
  2. 没有必要浪费符号字体。
  3. 使用\textcolor似乎比抛出几个\color指令更好。
  4. 您可以减少代码重复。
  5. 而要\providecommand使用\DeclareRobustCommand

堆叠是通过 获得的\ialign

\documentclass{article}

\makeatletter
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{iftex}
\iftutex
  \RequirePackage{fontspec}
  \newfontface{\PJLlogo@font}{LinBiolinum_R.otf}
\else
  \RequirePackage[T1]{fontenc}
  \newcommand{\PJLlogo@font}{\normalfont\fontfamily{LinuxBiolinumT-TLF}\selectfont}
\fi

\newcommand{\PJLSigmaJ}{%
  \vbox{\offinterlineskip
    \ialign{%
      \hfil##\hfil\cr
      \hidewidth\scalebox{0.4}{\rotatebox{-10}{\usefont{U}{zeur}{b}{n}\symbol{"06}}}\hidewidth\cr
      \noalign{\kern0.2ex}
      \j\cr
    }%
  }%
}

\newcommand{\ProjLib@generic}[1]{%
  \begingroup
  \PJLlogo@font
  \textcolor{blue!60!cyan}{P}%
  \textcolor{blue!45!cyan}{r}%
  \textcolor{blue!30!cyan}{o}%
  \textcolor{green!70!black}{#1}%
  \textcolor{red!20!yellow}{L}%
  \textcolor{red!40!yellow}{i}%
  \textcolor{red!60!yellow}{b}%
  \endgroup
}
\DeclareRobustCommand*{\ProjLib}{\ProjLib@generic{\PJLSigmaJ}}
\DeclareRobustCommand*{\ProjLibText}{\ProjLib@generic{j}}
\makeatother

\begin{document}

\tiny \ProjLib
\normalsize \ProjLib
\Huge \ProjLib

\tiny \ProjLibText
\normalsize \ProjLibText
\Huge \ProjLibText

\end{document}

在此处输入图片描述

答案2

使用 进行\rlap重叠。然后,您只需用\kern相等的 向右精确撤消 向左 即可\kern。这可以解决正确的字母间距问题,但正如 OP 指出的那样,重叠在不同尺寸下并不一致。

您有两个选择:尝试提供非线性字距,就像我在下面的 MWE 中所做的那样,或者(就像我所做的那样),使用替代版本,采用理想的字距徽标\normalsize并将其缩放到适当的字体大小\scalerel*

\documentclass{article}

\makeatletter
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{iftex}
\ifdefined\fontspec
    \newcommand{\PJLlogo@font}{\normalfont\fontspec{LinBiolinum_R.otf}\selectfont}
\else
    \PassOptionsToPackage{T1}{fontenc}
    \RequirePackage{fontenc}
    \newcommand{\PJLlogo@font}{\normalfont\fontfamily{LinuxBiolinumT-TLF}\selectfont}
\fi
\DeclareSymbolFont{PJLupright}{U}{zeur}{b}{n}
\DeclareMathSymbol{\PJLSigma}{\mathalpha}{PJLupright}{"06}

\providecommand*{\ProjLib}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}\j%
\kern-.75ex
\kern+.003\dimexpr\f@size\dimexpr\f@size pt\relax
\smash{\rlap{\raisebox{0.56em}{\scalebox{0.4}{%
  \rotatebox{-10}{$\PJLSigma$}}}}}%
\kern+.75ex
\kern-.003\dimexpr\f@size\dimexpr\f@size pt
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}

\providecommand*{\ProjLibText}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}j%
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}
\makeatother

\usepackage{scalerel}
\newcommand\altProjLib{\scalerel*{$\normalsize\ProjLib$}{Pj}}
\begin{document}

\tiny \altProjLib
\normalsize \altProjLib
\Huge \altProjLib

\tiny \ProjLib
\normalsize \ProjLib
\Huge \ProjLib

\tiny \ProjLibText
\normalsize \ProjLibText
\Huge \ProjLibText


\end{document}

在此处输入图片描述

或者,以 egreg 为先锋,人们可以将 sigma 符号堆叠在 上\j,这里使用\stackengine语法。

\documentclass{article}

\makeatletter
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{iftex}
\usepackage{stackengine}
\ifdefined\fontspec
    \newcommand{\PJLlogo@font}{\normalfont\fontspec{LinBiolinum_R.otf}\selectfont}
\else
    \PassOptionsToPackage{T1}{fontenc}
    \RequirePackage{fontenc}
    \newcommand{\PJLlogo@font}{\normalfont\fontfamily{LinuxBiolinumT-TLF}\selectfont}
\fi
\DeclareSymbolFont{PJLupright}{U}{zeur}{b}{n}
\DeclareMathSymbol{\PJLSigma}{\mathalpha}{PJLupright}{"06}

\providecommand*{\ProjLib}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}
\smash{\stackengine{.1ex}{\j}{%
  \scalebox{0.4}{\rotatebox{-10}{$\PJLSigma$}}%
  }{O}{c}{F}{T}{S}}%
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}

\providecommand*{\ProjLibText}{%
\begingroup%
\PJLlogo@font%
\color{blue!60!cyan}P%
\color{blue!45!cyan}r%
\color{blue!30!cyan}o%
\color{green!70!black}j%
\color{red!20!yellow}L%
\color{red!40!yellow}i%
\color{red!60!yellow}b%
\endgroup%
}
\makeatother

\begin{document}

\tiny \ProjLib
\normalsize \ProjLib
\Huge \ProjLib

\tiny \ProjLibText
\normalsize \ProjLibText
\Huge \ProjLibText


\end{document}

在此处输入图片描述

相关内容