2

I'm using the Lyx editor.

Is it possible, in general, to mix Hebrew characters in a math formula ("math-mode" in Lyx)?

When trying to compile a Lyx file with Hebrew in a math formula I get this kind of error:

LaTeX Error: Command \hebgimel unavailable in encoding T1.

LaTeX Error: Command \hebayin unavailable in encoding T1.

Example of a .Lyx file which gives the mentioned error: http://pastebin.com/UvPTwML1

Example of a .tex file which gives the mentioned error: http://pastebin.com/61VES9wV

6
  • more information would be useful. however, you might try \text{\hebgimel} to temporarily "release" you from math mode constraints while remaining in math mode for the main expression (requires amsmath). Dec 8, 2013 at 15:18
  • Can you post both a MWE .lyx file and the exported .tex file please? Does Hebrew work for you outside of math formulas? Are you using XeTeX to compile?
    – scottkosty
    Dec 9, 2013 at 4:32
  • Hebrew works outside math formulas. I'll add the MWEs to the post.
    – pazbunis
    Dec 9, 2013 at 7:26
  • @barbarabeeton: which details could help? (the solution you've mentioned is in fact the way I was doing it initially)
    – pazbunis
    Dec 9, 2013 at 7:34
  • @user2190298 -- re details, it's recommended to post the actual (non)compilable example (not just a link; those sometimes go dead, and we like to think of this forum as a "perpetual resource"). that allows readers to make most efficient use of their time in tackling the problem. Dec 9, 2013 at 15:04

1 Answer 1

3

The following .lyx file works for me. I went to Document > Settings > Fonts and clicked on "use non-TeX fonts", then I set the fonts to the Free{Serif,Sans,Mono} fonts. Then I exported to PDF with XeTeX.

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language hebrew
\language_package default
\inputencoding auto
\fontencoding global
\font_roman FreeSerif
\font_sans FreeSans
\font_typewriter FreeMono
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mathdots 1
\use_mhchem 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset Formula $a+b=\text{םולש}$
\end_inset


\end_layout

\end_body
\end_document

The following .tex files is produced from the above .lyx file:

%% LyX 2.1.0dev created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{article}
\usepackage{amstext}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{FreeSerif}
\setsansfont[Mapping=tex-text]{FreeSans}
\setmonofont{FreeMono}
\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
$a+b=\text{םולש}$  
\end{document}

I get the following output:

enter image description here

8
  • I tried changing the fonts as you wrote, but that didn't work either. Also, when trying to compile (using TeXworks) the .tex file you produced with XeTex I get this Error: Undefined control sequence. l.3 \documentclass [english,hebrew]{article}
    – pazbunis
    Dec 9, 2013 at 8:35
  • @user2190298 What about when trying to compile the .lyx file with XeTeX (you put that you tried changing the fonts separately and that you tried compiling the .tex file but not that you tried the .lyx file)? I am on Ubuntu with TeX Live 2013 by the way.
    – scottkosty
    Dec 9, 2013 at 8:42
  • I tried compiling the .lyx file but that goes into some infinite loop until I get a "stop" message from LyX. I'm using MS Windows so I used MS sans serif (since I don't have the free package). I'm using LyX 2.0.5.1.
    – pazbunis
    Dec 9, 2013 at 9:00
  • @user2190298 Can you compile the Hebrew splash (open Examples/he/splash.lyx) with XeTeX and those fonts? If not, I would suggest trying different fonts (that support Hebrew).
    – scottkosty
    Dec 9, 2013 at 9:11
  • I actually have a problem compiling the Hebrew splash screen with XeTex (the pdf is created but with gibberish). When I use ps2pdf or dvipdfm it comes out Okay, though.
    – pazbunis
    Dec 9, 2013 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .