当我编译包含嵌入英文文本的数学公式的文档时,我遇到了这个奇怪的问题。
例如,如果我在 LyX 编辑器上的输入如下所示:
然后使用 XeTeX 输出的 PDF 如下:
(文本环境中的英文单词顺序颠倒了,其他保持不变)
我找了好久,还没看到有人遇到这个问题。有什么建议吗?
LyX 示例文件:
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
%%% Set Hebrew and English fonts
\setmonofont[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily{\englishfont}[Ligatures=TeX]{TeX Gyre Pagella}
%\newfontfamily{\englishfont}[Ligatures=TeX]{Latin Modern Roman}
% Proper font size in math mode.
\setmathrm[Ligatures=TeX]{Latin Modern Math}
%%% Another way is to set just the Hebrew fonts:
%\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
%\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
%\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
% consider using \usepackage{iffont}
%%% Sets both header and footer
\fancyhf{} % sets to nothing
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\textup{\thepage}}
\renewcommand*{\refname}{Bibliography}
%%% Some alternative styles
\ifcsname question\endcsname
\theoremstyle{definition}
\newtheorem{quesh}[thm]{ש×לה}
\renewenvironment{question}{\begin{quesh}}{\end{quesh}}
\else
\fi
\ifcsname sol*\endcsname
\theoremstyle{remark}
\newtheorem*{emphsol*}{פתרון}
\renewenvironment{sol*}{\begin{emphsol*}}{\end{emphsol*}}
\else
\fi
\makeatletter
\@addtoreset{thm}{section}
\makeatother
\end_preamble
\use_default_options true
\begin_modules
theorems-ams
theorems-ams-extended
\end_modules
\maintain_unincluded_children false
\language hebrew
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "David CLM"
\font_sans "default" "Hadasim CLM"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format pdf4
\output_sync 1
\output_sync_macro "\synctex=1"
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2.5cm
\topmargin 3cm
\rightmargin 2.5cm
\bottommargin 3cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\bullet 0 2 5 -1
\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
\[
\text{firstword secondword thirdword fourthword}
\]
\end_inset
\end_layout
\end_body
\end_document
示例文件的 TeX 输出:
%% LyX 2.3.3 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{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{David CLM}
\setsansfont[Mapping=tex-text]{Hadasim CLM}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\synctex=1
\usepackage{pifont}
\makeatletter
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%%% Set Hebrew and English fonts
\setmonofont[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily{\englishfont}[Ligatures=TeX]{TeX Gyre Pagella}
%\newfontfamily{\englishfont}[Ligatures=TeX]{Latin Modern Roman}
% Proper font size in math mode.
\setmathrm[Ligatures=TeX]{Latin Modern Math}
%%% Another way is to set just the Hebrew fonts:
%\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
%\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
%\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
% consider using \usepackage{iffont}
%%% Sets both header and footer
\fancyhf{} % sets to nothing
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\textup{\thepage}}
\renewcommand*{\refname}{Bibliography}
%%% Some alternative styles
\ifcsname question\endcsname
\theoremstyle{definition}
\newtheorem{quesh}[thm]{ש×לה}
\renewenvironment{question}{\begin{quesh}}{\end{quesh}}
\else
\fi
\ifcsname sol*\endcsname
\theoremstyle{remark}
\newtheorem*{emphsol*}{פתרון}
\renewenvironment{sol*}{\begin{emphsol*}}{\end{emphsol*}}
\else
\fi
\makeatletter
\@addtoreset{thm}{section}
\makeatother
\AtBeginDocument{
\def\labelitemi{\Pisymbol{psy}{183}}
}
\makeatother
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\LRE{
\[
\text{firstword secondword thirdword fourthword}
\]
}
\end{document}
答案1
您在 LyX 中遇到了这个令人厌烦的错误:https://www.lyx.org/trac/ticket/7207顺便说一句(我不指望你能找到这个 bug,尽管我知道它存在,但我还是花了很长时间才找到它),我是通过查看所有 LyX 组件 BiDi 支持错误。