自定义符号内的空间已修改

自定义符号内的空间已修改

为什么我的自定义\commonroot符号在嵌套更深 1 级时会被“破坏”?

平均能量损失

\documentclass{article}

\usepackage{graphicx}


\NewDocumentCommand{\lex}{>{\SplitArgument{1}{,}}m}{\lexAUX#1}

\NewDocumentCommand{\lexAUX}{mm}{%
    \textit{#1}%
    \IfValueT{#2}{\textup{\textsubscript{\textsc{#2}}}}%
}

\NewDocumentCommand{\commonroot}{}{%
    \raisebox{-0.5ex}{\rotatebox{45}{\textleftarrow\!\!}}\kern0.025em%
    \raisebox{0.5525ex}{\rotatebox{-45}{\!\!\textrightarrow}}}

\NewDocumentCommand{\coolsource}{mm}{%
    \textup{\{}\lex{#1}{\commonroot}\lex{#2}\textup{\}}}

\NewDocumentCommand{\coolderivback}{mm}{%
    \textup{\{}\lex{#1}\kern0.25em\textleftarrow\kern0.25em\lex{#2}\textup{\}}}

\NewDocumentCommand{\sourceback}{mmm}{%
    \coolderivback{\coolsource{#1}{#2}}{#3}}    


\begin{document}
    

        \coolsource{rétracter,v}{rétraction,n}
        
        \sourceback{rétracter,v}{rétraction,n}{retraire,v}
    

\end{document}


在此处输入图片描述

编辑

我的文件中的实际符号,我使用英语字体格式一种,如下图所示,我不想使用数学模式:

在此处输入图片描述

答案1

如果添加打印字符,例如!

\NewDocumentCommand{\commonroot}{}{!%
    \raisebox{-0.5ex}{\rotatebox{45}{\textleftarrow\!\!}}\kern0.025em%
    \raisebox{0.553ex}{\rotatebox{-45}{\!\!\textrightarrow}}}

你看

在此处输入图片描述

这清楚地表明您处于不同的字体设置中。

添加\textup使事物正常化

在此处输入图片描述


\NewDocumentCommand{\commonroot}{}{\textup{!%
    \raisebox{-0.5ex}{\rotatebox{45}{\textleftarrow\!\!}}\kern0.025em%
    \raisebox{0.553ex}{\rotatebox{-45}{\!\!\textrightarrow}}}}

答案2

您可以使用不受当前文本字体影响的数学符号。

\documentclass{article}
\usepackage{xparse}

% Define the 'lex' command for lexical entries
\NewDocumentCommand{\lex}{>{\SplitArgument{1}{,}}m}{\lexAUX#1}

% Auxiliary command to handle 'lex' arguments
\NewDocumentCommand{\lexAUX}{mm}{%
    \textit{#1}%
    \IfValueT{#2}{\textsubscript{\textup{\textsc{#2}}}}%
}

% Define the 'commonroot' symbol
%\NewDocumentCommand{\commonroot}{}{%
%    \raisebox{-0.5ex}{\rotatebox{45}{\textleftarrow\!\!}}\kern0.025em%
%    \raisebox{0.553ex}{\rotatebox{-45}{\!\!\textrightarrow}}}
\NewDocumentCommand{\commonroot}{}{%
  \ensuremath{\scriptstyle{\swarrow}\mkern-2.6mu{\searrow}}%
}


% Define the 'coolsource' command
\NewDocumentCommand{\coolsource}{mm}{%
    \textup{\{}\lex{#1}{\commonroot}\lex{#2}\textup{\}}}

% Define the 'coolderivback' command
\NewDocumentCommand{\coolderivback}{mmg}{%
    \textup{\{}\lex{#1}\kern0.25em\textleftarrow\kern0.25em
    \lex{#2}\IfValueT{#3}{\kern0.25em\textleftarrow\kern0.25em
    \lex{#3}}\textup{\}}}

% Define the 'sourceback' command
\NewDocumentCommand{\sourceback}{mmm}{%
    \coolderivback{\coolsource{#1}{#2}}{#3}}    

\begin{document}
    
    \sourceback{rétracter,v}{rétraction,n}{retraire,v}
    
    \coolsource{rétracter,n}{rétraction,n}
    
\end{document}

在此处输入图片描述

您可以使用 STIX Two 获得与 Times New Roman 兼容的箭头。

\documentclass{article}
\usepackage{fontspec}
\usepackage{graphicx}

\setmainfont{Times New Roman}

\newfontface{\arrows}{STIX Two Math}[Scale=0.7]

\NewDocumentCommand{\lex}{>{\SplitArgument{1}{,}}m}{\lexAUX#1}

\NewDocumentCommand{\lexAUX}{mm}{%
    \textit{#1}%
    \IfValueT{#2}{\textsubscript{\textup{\textsc{#2}}}}%
}

\NewDocumentCommand{\commonroot}{}{%
  \raisebox{\depth}{%
    \normalfont\arrows
    \kern0.225em
    \symbol{"2199}\kern-0.225em\symbol{"2198}%
    \kern0.225em
  }%
}
%\NewDocumentCommand{\commonroot}{}{%
%    \raisebox{-0.5ex}{\rotatebox{45}{\textleftarrow\!\!}}\kern0.025em%
%    \raisebox{0.5525ex}{\rotatebox{-45}{\!\!\textrightarrow}}}

\NewDocumentCommand{\coolsource}{mm}{%
    \textup{\{}\lex{#1}{\commonroot}\lex{#2}\textup{\}}}

\NewDocumentCommand{\coolderivback}{mm}{%
    \textup{\{}\lex{#1}\kern0.25em\textleftarrow\kern0.25em\lex{#2}\textup{\}}}

\NewDocumentCommand{\sourceback}{mmm}{%
    \coolderivback{\coolsource{#1}{#2}}{#3}}    


\begin{document}

        \coolsource{rétracter,v}{rétraction,n}
        
        \sourceback{rétracter,v}{rétraction,n}{retraire,v}

\end{document}

在此处输入图片描述

相关内容