
破線 を定義しようとしています\Uparrow
。最初の試みは、 を使用してtikz
、法線 の上に 2 つの白い四角形を描画し\Uparrow
、手動で四角形の適切な配置を見つけることです。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\newcommand{\Dasheduparrow}{
\begin{tikzpicture}[x=1, y=1]
\node (0,0) [inner sep=0] {$\Uparrow$};
\fill[fill=white] (-3,0.5) rectangle (2,-1);
\fill[fill=white] (-3,-2) rectangle (2,-3.5);
\end{tikzpicture}}
今すぐ入力して
\begin{document}
Text $\Dasheduparrow$ $\Downarrow$ $\Uparrow$ text.
\end{document}
分かりました
結果には非常に満足しています。ただし、3 つの質問があります。
- 法線
\Downarrow
とを同じ配置にするにはどうすればよいでしょう\Uparrow
か。新しいシンボルはテキストのベースラインに揃えられていますが、2 つのデフォルトのシンボルは少し下方にシフトされています。 - この新しいシンボルを正しく伸縮可能にするにはどうすればよいでしょうか。
\LARGE Text $\Dasheduparrow$ $\Downarrow$ $\Uparrow$ text.
出力を 見ると、下にある部分
\Uparrow
が拡大されているのに、白い四角形は拡大されていないことがわかります。 - 私が提案したものよりも良い解決策はありますか?
答え1
修正された回答
OP は、私の元の回答では、ギャップは異なるフォント サイズ (および数式スタイル) で拡大縮小されないとコメントしています。これは、tikz
私のstackengine
パッケージを使わずに使用し、ギャップ サイズを数式スタイルで拡大縮小することで解決できます (白い長方形オーバーレイの寸法としてではなく、パッケージの [Local-Mathstyle ex] を使用しscalerel
ます\LMex
) 。cm
pt
OP の別の質問に答えると、\ThisStyle{...\SavedStyle...}
構文により、現在の数式スタイルを、通常は失われる構造、この場合は ed されてスタックされている に持ち込むことができます\hbox
。\vcenter
これは、強化された と同等です\mathchoice
が、必要な入力量が大幅に削減されることがよくあります。
\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{scalerel,stackengine,xcolor}
\newcommand{\Dasheduparrow}{\ThisStyle{\vcenter{\hbox{$%
\stackengine{0.45\LMex}{\stackengine{-.15\LMex}{$\SavedStyle\Uparrow$}
{\textcolor{white}{\rule{1.1\LMex}{0.3\LMex}}}{O}{c}{F}{T}{L}%
}{\textcolor{white}{\rule{1.1\LMex}{0.3\LMex}}}{O}{c}{F}{T}{L}%
$}}}}
\begin{document}
Text $\Dasheduparrow$ $\Downarrow$ $\Uparrow$ text.
$\Dasheduparrow \scriptstyle \Dasheduparrow \scriptscriptstyle \Dasheduparrow$
\LARGE
Text $\Dasheduparrow$ $\Downarrow$ $\Uparrow$ text.
\end{document}
オリジナルの回答
ここでは、OP の定義から始めます。
\vcenter
ただし、その後、数式軸の中央に配置するために使用し、scalerel
数式スタイルを保持する機能も使用します。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{scalerel}
\newcommand{\Dasheduparrow}{\ThisStyle{\vcenter{\hbox{$
\begin{tikzpicture}[x=1, y=1]
\node (0,0) [inner sep=0] {$\SavedStyle\Uparrow$};
\fill[fill=white] (-3,0.5) rectangle (2,-1);
\fill[fill=white] (-3,-2) rectangle (2,-3.5);
\end{tikzpicture}$}}}}
\begin{document}
Text $\Dasheduparrow$ $\Downarrow$ $\Uparrow$ text.
$\Dasheduparrow \scriptstyle \Dasheduparrow \scriptscriptstyle \Dasheduparrow$
\end{document}
答え2
簡単な回避策(少し不格好かもしれませんが):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz,calc}
\newcommand{\Dasheduparrow}{
\begin{tikzpicture}[x=1, y=1]
\node (0,0) [inner sep=0] {$\Uparrow$};
\fill[fill=white] (-3,0.5) rectangle (2,-1);
\fill[fill=white] (-3,-2) rectangle (2,-3.5);
\end{tikzpicture}}
\begin{document}
Text \parbox{\widthof{$\Dasheduparrow$}}{$\Dasheduparrow$} $\Downarrow$ $\Uparrow$ text.
\end{document}
parbox
ここでは、コンテンツを中央揃えにするためにを使用しました。
\parbox{\widthof{$\Dasheduparrow$}}{$\Dasheduparrow$}
もう 1 つの可能性は、数式センタリング コマンドを使用することです。
\vcenter{\hbox{\Dasheduparrow}}