5

My question is a like the one here: only with different symbol.

With typing: \[\^{\i}\] i want to get a get a i with a ^ (replacing the dot) on its head.

So far, so good. Means it works (i get the symbol i wish to get) but TeXstudio (Version 2.12.10 (git 2.12.10)) gives me two warnings also:

Command \^ invalid in math mode

and

Command \i invalid in math mode

The command \hat{i} gives me an i with a ^ ontop. That is not excactly what i want.

The solution with $\o$ replaced by \varnothing or \Emptyset seams to be the same, well maybe i'm just searching for the right word for my symbol in question?

Any suggestions?


Update 1 after getting a solution form @Henri Menke

(On the left side of the equation)
The left one is the result of \hat{\imath} result, \cdot, the right one it the result of \^{\i}

The left one is the result of <code>\hat{\imath}</code>, the right one is the result of <code>\^{\i}</code>

With other words:
Not the same: The left one is the result of <code>\hat{\imath}</code>, the right one is the result of <code>\^{\i}</code>
Lets assume that \hat{\imath} is indeed the right symbol, than i have to write \(\hat{\imath}\) (with math enviroment) every time i need to use it in my text for reference?


Update 2 I knew that link before asking my question but it wasn't helpfull in my case. Maybe have a look here, for looking up other unknown symbols if you have a "similar" question (Please credit him if it helps you)

  • 5
    Use \hat{\imath}. – Henri Menke Aug 05 '18 at 04:27
  • 2
    Please clarify what you need to obtain. Is it an upright or a slanted version of the dotless letter “i” with a hat on top? And, will you be using this symbol in text mode or in math mode? – Mico Aug 05 '18 at 05:49
  • 1
    @Mico I think it should be itallic like every other variable in every equation too. But i have to write some text about the variables i'm using so i need to write it sometimes in my text too With the same look. – user167193 Aug 05 '18 at 06:00
  • 1
    last question: of course, as every in-line (in text) math expression hat to be put in math environment. – Zarko Aug 05 '18 at 06:00
  • 1
    @Zarko Well, i was a little bit confused because of course you can use \^{\i} without being math mode the same way. Thank you for clarification. – user167193 Aug 05 '18 at 06:04
  • 3
    @user167193 - If it's a symbol for a math variable, you should be using (math) italics, i.e., you should be using hat{\imath}. Obviously, this requires the use of math mode. Henri's answer is correct. – Mico Aug 05 '18 at 06:09
  • 1
    @Mico Thanks for clarification. I will honor him tomorrow. (Can i honor your comment/you as well?) – user167193 Aug 05 '18 at 06:10
  • 1
    @user167193 - Once your reputation count is sufficiently high, you can upvote both comments and answers. – Mico Aug 05 '18 at 06:12
  • 2
    @Mico Thank you. I will if i can. :-) Good night. – user167193 Aug 05 '18 at 06:13

3 Answers3

9

You can access the dotless version of i and j in math mode using \imath and \jmath.

\documentclass{article}
\begin{document}
$\hat{\imath}$
$\hat{\jmath}$
\end{document}

enter image description here

Henri Menke
  • 109,596
  • 1
    well yes, maybe you are right. I tried you solution. I get a slighly different looking i with a ^ head than before. is that correct / ok ? I will try to add a picture and a update to my question. – user167193 Aug 05 '18 at 04:41
  • 2
    If this is the way to go to get the itallic version of the i with the ^ as head than i will accept your answer tomorrow. :) – user167193 Aug 05 '18 at 06:07
4

You can set up a similar tool to \^:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{letltxmacro}

\ExplSyntaxOn
\LetLtxMacro \egreg_hat:n \hat % save the original command

\RenewDocumentCommand{\hat}{m}
 {
  \str_case_e:nnF { \tl_trim_spaces:n { #1 } }
   {
    {i}{\egreg_hat:n { \imath }}
    {j}{\egreg_hat:n { \jmath }}
   }
   { \egreg_hat:n { #1 } }
 }
\ExplSyntaxOff

\begin{document}

$\hat{a}+\hat{i}+\hat{j}$

\end{document}

enter image description here

egreg
  • 1,121,712
3

You can always use \text{} to escape math mode, provided by the amsmath package. So the solution would be \^{\i} when in text mode, and \text{\^{\i}} when in math mode.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$f(t) = \sin(\text{\^{\i}} \cdot t)$.
\end{document}

enter image description here

  • Atleast this would supress the warning. You are right. But even in your example the roman i with the ^ head ... I don't know maybe if it represents a constant or something like that. But for my usage i'm happy with @Henri's answer. – user167193 Aug 05 '18 at 15:59