There are some utf8 symbols (ĉ ĝ ...) in the input for pdflatex and I use in preambula commands like


and so on with \hat, \acute, \grave,\ddot, \tilde, \check, \bar, \breve
(to avoid messages like: Unicode char \u8:ǹ not set up for use with LaTeX ). So I replace symbols (utf8) by appropriate latex commands in math mode. Do any bad situations can be with this because commands are in math mode and do I must change to use text mode commands? It works, no error. I worry about future use of this preambula, do I shall be in trouble with it. Here is part of the whole text:



\usepackage{textalpha}   % Greek symbols

%Latin Accents




% GREEK Symbols var






Acute: á ć é ǵ í ḱ ĺ ḿ ń ó ṕ ŕ ś ú ẃ ý ź Á Ć É Ǵ Í Ḱ Ĺ Ḿ Ń Ó Ṕ Ŕ Ś Ú Ẃ Ý Ź   \\

α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω Α Β Γ Δ Ε Ζ Η Θ
Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω 

var греческие буквы

varepsilon ε   
varkappa ϰ    
varphi φ     
varpi ϖ     
varrho ϱ     
varsigma ς     
vartheta ϑ    

  • 1
    It is not so clear what for you need those. Like they stand now, you are declaring italic characters of your math font. Don't know if that works, but it looks strange. Please provide some minimal code which does result in the mentioned error and we try to help you on this. Maybe this is an easier approach. Thanks.
    – LaRiFaRi
    Jun 5, 2015 at 7:38
  • If you use those letters in text, you should use \^c and \^g.
    – egreg
    Jun 5, 2015 at 8:15
  • It works - no error, I worry about future use of this preambula - will not I be in trouble. Here is the whole text:
    – vmk
    Jun 5, 2015 at 9:07

2 Answers 2


You can declare characters for use in text or math or both


But the definition that you suggest


is the worst of both worlds, it can not be used in math because of the $ but it will do the wrong thing, using math fonts not text fonts, if used in text.

  • 1
    Possibly \TextOrMath?
    – egreg
    Jun 5, 2015 at 8:20
  • 1
    Remember to load fixltx2e or use TeX Live 2015
    – egreg
    Jun 5, 2015 at 8:37
  • @vmk the \ifmmode one should work. what error do you get? Jun 5, 2015 at 9:49
  • and there was error message for both ifmmode and TextOrMath: Please use \mathaccents for accents in math mode
    – vmk
    Jun 5, 2015 at 9:52
  • @vmk you do not want $ in the definition. Jun 5, 2015 at 10:29

If you really(!) need to do it with math-characters you can use


\ensuremath makes sure you use math-mode (whether you are in a math-environment or not). \mathrm switches to upright math-font and should make it consistent with normal text.

  • There is no requirement that the font used for \mathrm is the same as the roman font used ion text although it happens to be the case with the default cm font setup) and of course this will always give upright roman even if the surrounding text is italic or bold or whatever. Jun 5, 2015 at 9:51
  • @DavidCarlisle True indeed, unless there is a method to check for surrounding text shape, it'll only work for upright text!
    – Horst
    Jun 5, 2015 at 13:18
  • 2
    @Horst it doesn't really work for upright text either, only by accident in some font setups where \mathrm matches the text font. Jun 5, 2015 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.