babel georgia 和 fontspec

babel georgia 和 fontspec
\documentclass{article}
\usepackage[georgian]{babel}
\usepackage{ifxetex}% load different packages with/without XeLaTex
\ifxetex
\usepackage{fontspec}
\setmainfont{sylfaen.ttf}
\else  % packages below are not needed with utf8 based engines
\usepackage[utf8]{inputenc}
\usepackage[T8M]{fontenc}
\fi%

\begin{document}

\begin{abstract}

test ტესტი

\end{abstract}

\section{Test section}
test ტესტი
\end{document}

一切pdflatex正常...当我激活语言时,georgian格鲁吉亚语文本不会显示...我知道 fontencoding 从 EU1/2 更改为 TU,但不知道为什么 EU1/2 被激活而 TU 没有被激活...

仅在 ldf 文件中从 EU 切换到 TU 没有帮助......

答案1

不幸的是,georgian.ldf尚未更新以支持TU。解决方法很简单:

\documentclass{article}

\usepackage[georgian]{babel}

\usepackage{ifxetex}% load different packages with/without XeLaTex

\ifxetex
  \def\georgianencoding{TU}
  \usepackage{fontspec}
  \setmainfont{DejaVu Serif}
\else  % packages below are not needed with utf8 based engines
  \usepackage[utf8]{inputenc}
  \usepackage[T8M]{fontenc}
\fi


\begin{document}

\begin{abstract}

test ტესტი

\end{abstract}

\section{Test section}
test ტესტი
\end{document}

在此处输入图片描述

以下是编辑后的版本georgian.ldf(仅相关部分):

\newif\if@kauni@ode
\ifdefined\luatexversion \@kauni@odetrue \else
\ifdefined\XeTeXrevision \@kauni@odetrue \fi\fi
\ifx\l@georgian\@undefined
  \@nopatterns{Georgian}
  \adddialect\l@georgian0
\fi
\def\@setgeorgianencoding{%
  \def\sce@a##1##2{%
    \edef\sce@b{##1}%
    \edef\sce@c{##2}%
    \ifx\sce@b\sce@c
      \let\georgiancoding\sce@c
    \fi}%
  \def\cdp@elt##1##2##3##4{%
    \sce@a{##1}{T8K}%
    \sce@a{##1}{T8M}%
    \if@kauni@ode
      \sce@a{##1}{TU}%TU
    \fi}%
  \cdp@list
}
\@setgeorgianencoding
\@onlypreamble\@setgeorgianencoding
\@onlypreamble\sce@a
\@onlypreamble\sce@b
\@onlypreamble\sce@c
\ifdefined\georgianencoding
\else
  \if@kauni@ode
    \def\georgianencoding{TU}
  \fi
  \else
    \edef\georgianencoding{T8M}
  \fi
  \PackageWarning{babel}%
    {No Georgian font encoding has been loaded so far.\MessageBreak
     A font encoding should be declared before babel.\MessageBreak
     Default `\georgianencoding' encoding will be loaded
    }%
  \lowercase\expandafter{\expandafter\input\georgianencoding enc.def\relax}%
  \AtBeginDocument{\@setgeorgianencoding}
\fi

相关内容