Skip to content

Instantly share code, notes, and snippets.

@t-uda
Created January 7, 2014 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t-uda/8299787 to your computer and use it in GitHub Desktop.
Save t-uda/8299787 to your computer and use it in GitHub Desktop.
$\left(\hat{ ... }\right)$ のカッコが大きくて気持ち悪い ref: http://qiita.com/t_uda/items/05441624c28b802ca12e
\[
f\left(\hat{X}\right) {\lVert v \rVert}_{P\left(\hat{X}\right)}
\]
\[
f\left(\Hat{X}\right) {\lVert v \rVert}_{P\left(\Hat{X}\right)}
\]
%% 縦に大きくならないハット付き文字を作る。
%%%% \hbox to 0pt : 幅 0pt のボックスを作る。
%%%% \phantom : その文字列の大きさで何も表示されないボックスを作る。
%%%% \raisebox : ボックスの位置・サイズを変更する。
%%%% \mathchoice : 数式モードに応じて条件分岐する。
\def\Hat#1{{\fboxsep0pt\mathchoice
{\hbox to 0pt{\phantom{$\displaystyle #1$} }\raisebox{0ex}[0pt][0pt]{$\displaystyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\textstyle #1$} }\raisebox{0ex}[0pt][0pt]{$\textstyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\scriptstyle #1$} }\raisebox{0ex}[0pt][0pt]{$\scriptstyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\scriptscriptstyle #1$}}\raisebox{0ex}[0pt][0pt]{$\scriptscriptstyle\hat{#1}$}}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment