이전 섹션이 다른 언어로 끝나고 섹션 제목이 다른 언어로 시작하는 경우 기본 언어가 올바르게 다시 선택되지 않습니다.

이전 섹션이 다른 언어로 끝나고 섹션 제목이 다른 언어로 시작하는 경우 기본 언어가 올바르게 다시 선택되지 않습니다.

히브리어와 영어의 두 가지 언어로 된 문서에 XeLaTeX 관련 문제가 있습니다. 나는 히브리어에 대해 다른 글꼴을 사용합니다(여기서는 DejaVu Sans이지만 어떤 글꼴이든 가능합니다).

문제는 (1) 섹션이 히브리어 텍스트로 끝나고 (2) 다음 섹션 제목이 히브리어 텍스트로 시작하면 문서의 나머지 부분과 목차가 히브리어에 사용된 글꼴로 표시된다는 것입니다. 어떤 이유로 시스템이 기본 글꼴로 다시 전환되지 않습니다(아래 예 참조).

이 문제는 두 대 중 한 대의 컴퓨터에서만 발생합니다. 문제가 있는 컴퓨터는 TeX Live 2022가 설치된 Debian Bookworm을 실행하고 있습니다.여기. xelatex --version다음을 제공합니다:

XeTeX 3.141592653-2.6-0.999994 (TeX Live 2022)
kpathsea version 6.3.4
Copyright 2022 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 70.1; using 70.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.11.1; using 2.11.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 3.4.0; using 3.4.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.13.0; using 2.14.1

다른 컴퓨터에서는 문제가 없습니다. 이 머신은 동일한 소스에서 설치된 TeX Live 2022와 함께 Debian Bullseye를 실행합니다. 유일한 차이점은 다음과 xelatex --version같습니다.

Compiled with fontconfig version 2.13.0; using 2.13.1

따라서 문제가 있는 시스템은 최신 글꼴 구성을 사용합니다. (문제가 해결되는지 테스트하기 위해 최신 시스템에서 이전 버전을 어떻게 사용할 수 있는지 모르겠습니다.) 모든 패키지( apttlmgr)는 두 시스템 모두에서 최신 상태입니다.

문제를 해결할 수 있는 방법이 있나요?

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont{DejaVu Sans}
\newcommand{\heb}[1]{\bgroup\normalfont\hebrewfont\RL{#1}\egroup}

\begin{document}

\tableofcontents

\section{First section}
\begin{hebrew}
    This section ends with Hebrew text.
\end{hebrew}
\section{\heb{אב} Section title starts with Hebrew}

\end{document}

여기에 이미지 설명을 입력하세요

여기에서는 "text. 히브리어 끝 섹션 This" 및 "אב"를 제외한 모든 항목이 DejaVu Sans가 아닌 기본 글꼴이어야 합니다.

답변1

처럼울리케 피셔(Ulrike Fischer)가 제안한, 사용

\newcommand{\heb}[1]{\bgroup\selectlanguage{hebrew}\RL{#1}\egroup}

문제를 해결합니다.

여기에 이미지 설명을 입력하세요

관련 정보