LyX ⇒ how to switch the language between text and math?
how to switch the language between text and math?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
how to switch the language between text and math?
\everymath
is called every time when it's switched to inline math,\everydisplay
is called every time when it's switched to displayed math, for example in equation environments.
Code: Select all
\documentclass{article}
\usepackage[ngerman,english]{babel}% loading two languages
\everymath{\selectlanguage{ngerman}}
\everydisplay{\selectlanguage{ngerman}}
\usepackage{amsmath}
\usepackage{parskip}
\begin{document}
tes"-ting english% ngerman shortcut "- doesn't work, but is visible instead
% i.e. ngerman is not active, but english
$\text{tes"-ting ngerman}$% here, "- works and is hidden, ngerman is active
tes"-ting english% again, ngerman shortcut "- doesn't work, english is active
\[ \text{tes"-ting ngerman} \]% also here, "- works and is hidden, ngerman is active
tes"-ting english% ngerman shortcut "- doesn't work any more, english is active again
\end{document}
Re: how to switch the language between text and math?
how to switch the language between text and math?
Code: Select all
\usepackage[ngerman,english]{babel}% last language in list will be document language
\everymath{\selectlanguage{ngerman}}
\everydisplay{\selectlanguage{ngerman}}
Make sure you also choose language=none in the language settings.
Regards
Re: how to switch the language between text and math?
Thanks.
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Re: how to switch the language between text and math?
Stefan