因此,我尝试将许多 Latex 徽标放在彼此之上,但我不知道徽标的确切尺寸,无法将其移动到正确的位置。
\documentclass{article}
\usepackage{amsmath}
\newcommand{\latex}{\text{\LaTeX}} % Make the Latex command easier to type
\newcount\tmp % Dummy counter for the loop
\newcommand{\latexx}[2]{
%1 is the distance moved
%2 is the number of logos to stack
\tmp=0
\latex
\loop
\advance\tmp by 1
\hspace{#1 em}\latex
\ifnum\tmp<#2
\repeat
}
\begin{document}
\[
\latex
\]
\[
\latexx{-2.566364}{10000}
\]
\end{document}
这适用于堆叠它们并且非常接近,但当我增加堆叠的数量时,您会发现它并不精确。
是否有人知道我需要输入的确切距离(以 em 为单位)才能使它们彼此无法区分?
答案1
您只需使用\sbox0{\LaTeX}\the\wd0
打印出 的宽度即可\latex
。它以 输出pt
,因此我只需在循环定义中将更改em
为即可。pt
\documentclass[]{article}
\usepackage{amsmath}
\newcommand{\latex}{\text{\LaTeX}} % Make the Latex command easier to type
\newcount\tmp % Dummy counter for the loop
\newcommand{\latexx}[2]{
%1 is the distance moved
%2 is the number of logos to stack
\tmp=0
\latex
\loop
\advance\tmp by 1
\hspace{#1 pt}\latex
\ifnum\tmp<#2
\repeat
}
\begin{document}
\sbox0{\LaTeX}\the\wd0 % Prints the width of \latex, leave this out of main code
\[
\latex
\]
\[
\latexx{-25.66368}{10000}
\]
\end{document}