hohei’s diary

備忘録?

tikzで引く下線

f:id:hohei3108:20170923172214p:plain

\ubumps{あああ}\ucoil{あああ}\udot{あああ}\\
\usnake{あああ}\underline{あああ}\uzigzag{あああ}\\
\usnake{$\dfrac{1}{360}$}\uzigzag{$\dfrac{1}{360}$}\underline{$\dfrac{1}{360}$}ああああ

下のやつをプリアンブルなどに貼り付ければ,上の記述で下線が使えます.latexには多くの下線パッケージがあるのですが,どれも気に食わなかったので作りました ω

参考というかほとんどパクった記事↓ tex.stackexchange.com

\newcommand{\udot}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1.5pt,outer ysep=0pt,outer xsep=-2pt] (todotted) {#1};
        \draw[densely dotted,thick] (todotted.south west) -- (todotted.south east);
    }%
}%

\newcommand{\uzigzag}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1.2pt,outer ysep=0pt,outer xsep=-2pt] (todotted) {#1};
        \draw[decorate,decoration={zigzag,amplitude=0.2mm,segment length=1mm}] (todotted.south west) -- (todotted.south east);
    }%
}

\newcommand{\usnake}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1.5pt,outer ysep=0pt,outer xsep=-2pt] (todotted) {#1};
        \draw[decorate,decoration={snake,amplitude=0.2mm,segment length=1mm}] (todotted.south west) -- (todotted.south east);
    }%
}%

\newcommand{\ucoil}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1.5pt,outer ysep=0pt,outer xsep=-2pt] (todotted) {#1};
        \draw[decorate,decoration={coil,amplitude=0.2mm,segment length=1mm}] (todotted.south west) -- (todotted.south east);
    }%
}%

\newcommand{\ubumps}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1.5pt,outer ysep=0pt,outer xsep=-2pt] (todotted) {#1};
        \draw[decorate,decoration={bumps,amplitude=0.4mm,segment length=2mm}] (todotted.south west) -- (todotted.south east);
    }%
}%