#5836 closed defect (duplicate)
Cyrillic formatted text in mathmode
Reported by: | Owned by: | lasgouttes | |
---|---|---|---|
Priority: | high | Milestone: | 1.6.3 |
Component: | general | Version: | 1.6.1 |
Severity: | normal | Keywords: | |
Cc: | milde@…, forenr@…, vfr@… |
Description
Hi, dear developers!
We have mathtext package to write russian in math mode. By default russian letters are
upright, but we can say:
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it}
аnd make them italic (or slanted etc.). That is very important possibility, but in LyX it
doesn't work! I think, the occasion is in LyX code, which programm adds into document:
\DeclareRobustCommand{\lyxmathsym}[1]{\ifmmode\begingroup\def\b@ld{bold}
\def\rmorbf##1{\ifx\math@version\b@ld\textbf{##1}\else\textrm{##1}\fi}
\mathchoice{\hbox{\rmorbf{#1}}}{\hbox{\rmorbf{#1}}}
{\hbox{\smaller[2]\rmorbf{#1}}}{\hbox{\smaller[3]\rmorbf{#1}}}
\endgroup\else#1\fi}
but I don't know, how to resolve this problem. Could you fix it in next releases and how to
fix it now?
Best regards, neGODnick
Attachments (6)
Change History (24)
comment:1 by , 15 years ago
Cc: | added |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
This works for me. You should use T2A as fontenc and load mathext before
fontenc and babel. (PS. mathrm doesn't work in math somehow)
\documentclass[russian]{article}
\usepackage{mathtext}
\usepackage[T2A]{fontenc}
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it}
\usepackage[koi8-r]{inputenc}
\usepackage{babel}
\begin{document}
Ã$ÃÃ$
\end{document}
comment:4 by , 15 years ago
Cc: | added |
---|---|
Severity: | major → normal |
This works for me. You should use T2A as fontenc and load mathext before
fontenc and babel. (PS. mathrm doesn't work in math somehow)
\documentclass[russian]{article}
\usepackage{mathtext}
\usepackage[T2A]{fontenc}
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it}
\usepackage[koi8-r]{inputenc}
\usepackage{babel}
\begin{document}
Ã$ÃÃ$
\end{document}
comment:5 by , 15 years ago
My working (in TeX) example:
\documentclass{article}
\usepackage{mathtext} % Use russian letters in math mode. Load BEFORE fontenc!
\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it} % Select font for russian
letters in math mode. Load AFTER fontenc!
\usepackage[english,russian]{babel}
%\usepackage{amsmath} % amsmath not need for this example
\begin{document}
$X_{Ñлок}+Y_{беÑÑзок}=Z\quad(вÑего\:деÑевÑев\:в\:леÑÑ)$
\end{document}
Now I found temporary solution --- I add in âuserâ preambula (in LyX dialog
window) changed daclaration:
\DeclareRobustCommand{\lyxmathsym}[1]{\ifmmode\begingroup\def\b@ld{bold}
\def\rmorbf##1{\ifx\math@version\b@ld\textbf{##1}\else\textit{##1}\fi}
\mathchoice{\hbox{\rmorbf{#1}}}{\hbox{\rmorbf{#1}}}
{\hbox{\smaller[2]\rmorbf{#1}}}{\hbox{\smaller[3]\rmorbf{#1}}}
\endgroup\else#1\fi}
This works in LyX! I've changed command before first \fi (second line
downward). This was â\textrmâ, it may be changed with \textit, \textsl etc.
But this solution is not optimal and methodologically wrong, imho.
comment:6 by , 15 years ago
Forgotten:
Than we use changed LyX's declaration
\DeclareRobustCommand{\lyxmathsym}[1]{\ifmmode\begingroup\def\b@ld{bold}
\def\rmorbf##1{\ifx\math@version\b@ld\textbf{##1}\elseâ\CHANGEDâ{##1}\fi}
\mathchoice{\hbox{\rmorbf{#1}}}{\hbox{\rmorbf{#1}}}
{\hbox{\smaller[2]\rmorbf{#1}}}{\hbox{\smaller[3]\rmorbf{#1}}}
\endgroup\else#1\fi}
command \DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it} is not required. We may
delete it.
comment:7 by , 15 years ago
Keywords: | fixedintrunk added |
---|---|
Milestone: | → 1.6.3 |
Fixed in trunk:
http://www.lyx.org/trac/changeset/28731
by , 15 years ago
Attachment: | rus-math_lyx_.lyx added |
---|
My LyX example for russian letters in math mode
comment:8 by , 15 years ago
Note that the bug discussed here is not due to \lyxmathsym per se. If this
had been the case, it would have been solved by simply using
\renewcommand{\lyxmathsym}{}
in the user preamble. The bug is instead due to the fact that the package
mathtext should be loaded immediately before the LyX generated preamble.
There are a number of bugs related to this problem, e.g., #991, #5031,
and #5366.
Now this specific bug (cyrillic letters must be italic in math) is solved and
mathtext is not needed anymore.
comment:9 by , 15 years ago
Enrico, you wrote: â...(cyrillic letters must be italic in math)...â.
Not MUST be italic in math --- they MAY be italic, or slanted, or another ---
as user want! It must be POSSIBILITY TO CHANGE the font, and imho the behavior
in LyX must be the same as in TeX editors to be clear for user :â)
Best regards, neGODnick
comment:10 by , 15 years ago
This is already the case. If you want them slanted, then put the line
\renewcommand{\lyxmathsym}{\@ifstar{\lyxm@thsym\textsl}{\lyxm@thsym\textrm}}
in the user preamble (this works with the previous patch applied).
But you can even switch their shape multiple times in the same document.
by , 15 years ago
Attachment: | cyrillic-in-math.lyx added |
---|
How to input cyrillic chars in a formula with LyX 1.6.1
comment:11 by , 15 years ago
According to [1], "In all cases when Cyrillic letters are used in mathematics
they should be typed using the upright shape to distinguish them from the
Latin letters with a similar shape."
This would mean that by default, Cyrillic letters (like hebrew ones)
should not have the "mathalpha" feature.
[1] Russian Typographical Traditions in Mathematical Literature
Valentin Zaitsev, Andrew Janishewsky, Alexander Berdnikov,
EuroTEXô99 Proceedings, 1999.
http://www.uni-giessen.de/partosch/eurotex99/zaitsev.pdf
comment:12 by , 15 years ago
Cc: | added |
---|
comment:13 by , 15 years ago
attachments.isobsolete: | 0 → 1 |
---|
comment:14 by , 15 years ago
Note that, by default, TeX doesn't follow Russian conventions and letters are
typeset in italic in math. By marking as "mathalpha" Cyrillic letters, it is
easy to make them the way one wants, as requested in comment 11 and as
explained in comment 12. The moment the \lyxmathsym macro comes into one's
way, it can be redefined in the preamble as
\renewcommand{\lyxmathsym}{\@ifstar{}{}}
and it will be as it was not there. So the way things are now, one has maximum
flexibility. For example, nobody stops you from using \text, \textit, \textsl
and company for getting things as you want them without having to deal with
\lyxmathsym. AFAIC, this is a non-issue.
comment:15 by , 15 years ago
Subject: Re: Cyrillic formatted text in mathmode
Note that, by default, TeX doesn't follow Russian conventions and
letters are typeset in italic in math.
Russion conventions on this are in line with international conventions as
outlined in e.g. ISO 31, by the International Bureau of Weights and
Measures (BIPM) <http://www.bipm.org/en/si/si_brochure/> or the American
NIST <http://physics.nist.gov/Document/typefaces.pdf>:
Whether a letter in a math formula is typeset upright or italic depends
on its meaning and the context.
In short:
italic
is used for one-character symbols for variable values
taken from the Latin and Greek alphabet,
roman
is used for explanatory text, abbreviations and acronyms.
Usually, Russian mathematicans use Cyrillic letters for the second task
only and Latin and Greek for variable symbols.
(This is also the case in the example documents in the attachments.)
OTOH, by default, (La)TeX
a) does not accept Russian letters in math at all.
b) Latin letters (a-zA-Z) and small Greek letters are typeset italic,
c) capital Greek letters are typeset upright (roman).
(This is not in line with international conventions.)
d) provides the \mathrm, \mathit, ... commands for styling Latin chars.
By marking as "mathalpha" Cyrillic letters,
...
they are typeset as italic by default,
However, the default should correspondent to the most needed use case -
which for Cyrillic letters means "typeset upright". This way,
abbreviations like E_Ð¿Ð¾Ñ or acronyms like ÐÐÐ (GCD) come out in the
preferred typeface by default.
"mathalpha" should be reserved for Greek and Latin, while Cyrillic
letters should be handled like Armenian, Georgian, Hebrew, Arab,
Devanagari, ...
comment:16 by , 15 years ago
I think that the devel list is the right forum for discussing this.
If you are concerned about the default italic shape for Cyrillic letters,
please bring the discussion there. I have no strong opinion on this and
it boils down to simply taking away the "mathalpha" flag from unicodesymbols.
comment:17 by , 15 years ago
Keywords: | fixedintrunk removed |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
I am marking this bug as a duplicate of #5031 as the problem is not due to the \lyxmathsym macro per se but to the impossibility of inserting user commands before the LyX generated preamble.
comment:18 by , 15 years ago
Also see this related thread:
http://thread.gmane.org/gmane.editors.lyx.cvs/23318/focus=116774
Please, can you attach a small LaTeX file where you get italic Russian
letters in math mode? The following doesn't work for me:
\documentclass[russian]{article}
\usepackage[T1]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage{mathtext}
\usepackage{babel}
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it}
\begin{document}
Ã$\textrm{Ã}Ã$
\end{document}