使用 hieroglf 包修复行距

使用 hieroglf 包修复行距

我正在使用 hieroglf 包来显示象形文字。我需要在与常规文本相同的行中显示其中一些字符。问题是 hieroglf 字体似乎需要更多空间,因此在象形文字行和其上方行之间插入了额外的空间。示例:

行距问题

This is a normal line \\
This is a normal line. \\
This is a normal line.\\
This line \pmglyph{\HAi} has extra space above it. \\
So does this one. \pmglyph{\HSxxxix}\\
This one is fine.

我怎么能够:

  1. 强制行距为“正常”,即使这会导致线条重叠?

  2. 是否将象形文字的大小调整为“最小”适合正常行距?

答案1

我会重新调整象形文字的比例:

\documentclass{article}
\usepackage{hieroglf}

\DeclareFontFamily{OT1}{pmhg}{}
\DeclareFontShape{OT1}{pmhg}{m}{n}{ <-> s*[.55] pmhg }{}
\DeclareFontShape{OT1}{pmhg}{bx}{n}{ <-> ssub pmhg/m/n }{}
\DeclareFontShape{OT1}{pmhg}{b}{n}{ <-> ssub pmhg/m/n }{}
\DeclareFontShape{OT1}{pmhg}{m}{sl}{ <-> ssub pmhg/m/n }{}
\DeclareFontShape{OT1}{pmhg}{m}{it}{ <-> ssub pmhg/m/n }{}


\begin{document}
\noindent
This is a normal line. \\
This is a normal line.\\
This line \pmglyph{\HAi} has extra space above it. \\
So does this one. \pmglyph{\HSxxxix}\\
This one is fine.

\end{document}

在此处输入图片描述

答案2

可能有更优雅的解决方案,但你可以尝试使用包进行以下操作scalerel。我已缩放以匹配下一个文本大小,因为否则结果看起来太小,但你显然可以调整它以适应。

hieroglf我使用保存框来避免有关不适当的装箱/拆箱的投诉,如果我尝试直接在缩放命令中使用这些命令,似乎就会发生这种情况。

\documentclass{article}
\usepackage{hieroglf,scalerel}
\newsavebox{\myhier}
\newcommand*\myhieroglf[2][\large]{%
\sbox{\myhier}{%
  \pmglyph{#2}}%
  {#1\scalerel*{\usebox{\myhier}}{X}}}
\begin{document}
This is a normal line \\
This is a normal line. \\
This is a normal line.\\
This line \pmglyph{\HAi} has extra space above it. \\
So does this one. \pmglyph{\HSxxxix}\\
This one is fine.\\
This one may be \myhieroglf{\HAi} OK.\\
\Large For larger text, adjust \myhieroglf[\LARGE]{\HSxxxix} appropriately.
\end{document}

象形文字

相关内容