窗户上的泰米尔语

窗户上的泰米尔语

我在 Windows XP 中使用 TexniCentre 和 Miktex 2.8。我想排版泰米尔语文本,但到目前为止还没有成功。

请向我推荐一个适用于泰米尔语的 TeX/LaTex/变体设置。

提前感谢任何帮助。

答案1

(推荐)使用 XeLaTeX/LuaLaTeX 的多语言方式

你需要在你的操作系统;我使用了 Noto Serif Tamil 和 Noto Sans Tamil 作为以下示例。

\usepackage{polyglossia}
\setmainlanguage{tamil}
\setotherlanguage{english} %% OPTIONAL if you have some English text in your book

 %% Select fonts for Tamil
\newfontfamily\tamilfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}

%% OPTIONAL; Select fonts for English
\setmainfont{Times New Roman}
\setsansfont{Arial}

xelatex然后使用或编译该文档lualatex

使用 itrans 包的 pdfLaTeX 方式

可以使用itranspakcage,但它没有在 MikTeX 中正确打包。您需要手动安装它。下载itrans53-win32.zip来自 CTAN。解压内容(例如C:\itrans53\)后,假设<texmf>这是您的本地 TEXMF 树,

  • 将文件夹内容移动lib<texmf>\tex\latex\itrans
  • 将文件夹的内容移动fonts到适当的位置,即
    • *.mf<texmf>\fonts\source\itrans
    • *.afm<texmf>\fonts\afm\itrans
    • *.tfm<texmf>\fonts\tfm\itrans
    • *.pfb, *.pfa, *.pfm<texmf>\fonts\type1\itrans
    • *.ttf<texmf>\fonts\truetype\itrans
  • 刷新文件名数据库(例如通过 MikTeX 选项/设置)

然后尝试一下我在回答中给出的最小示例这个相关问题。您需要在文件夹itrans.exe中调用itrans53\bin。(但我不确定它是否适用于 64 位 Windows。)

答案2

对于我的 Ubuntu 系统,我使用包管理器来安装 itrans 和 itrans-fonts 包。没有麻烦,没有麻烦。

对于 Windows 和 MiKTex 2.9,设置过程更加复杂。下面是我为方便复制而创建的批处理文件。

1)安装MiKTeX

2)使用 MiKTeX 包管理安装 indic-type1 包和 devanagari 包。

3)从以下网址下载 itrans53-win32.ziphttp://www.aczoom.com/files/itrans/53/itrans53-win32.zip

4) 将 itrans53-win32.zip 解压到某个临时位置。我使用了 C:\temp\Tamil\ITRANS53。

5)打开以管理员身份运行的命令窗口。(许多副本位于 c:\program files\ 中,这需要以提升的权限运行该过程)

6) CD 到 ITrans 的临时位置(例如 C:\temp\Tamil\ITRANS53)

7)执行下面的批处理文件命令。

8)关闭命令窗口

9)右键单击开始->计算机,然后选择属性。

10)选择高级系统设置->环境变量

11) 添加新的系统环境变量,名为:ITRANSPATH。请参阅下面的批处理文件命令以了解此变量的确切值。

12)打开命令窗口

13)命令:

itrans -I <filename>.itx -o <filename>.tex 

现在可以工作并且 (pdf)latex 可以解析 itrans.exe 输出中引用的包、字体和命令。

我现在可以在 Ubuntu 和 Windows 7 中处理 LaTeX 文件,并对源文件(.Tex、.ITX 等)进行修订控制

批处理文件是:

echo off

rem Record where is MikTeX is installed
set MiktexRoot=C:\Program Files\MiKTeX 2.9

rem copy itrans.exe to a directory already within the path environment variable
rem   namely the path adjustment made by the installer for MiKTeX which puts
rem   all of the MiKTeX installed tools on the PATH variable
rem
rem for 32-bit windows systems remove the x64 suffix
copy ".\bin\*.exe" "%MiktexRoot%\miktex\bin\x64\*.*" /Y /V 

rem Create the directories within the MikTeX structure used or referenced by the itrans package
mkdir "%MiktexRoot%\doc\itrans"
mkdir "%MiktexRoot%\doc\itrans\contrib"
mkdir "%MiktexRoot%\fonts\source\public\itrans"
mkdir "%MiktexRoot%\fonts\type1\public\itrans" 
mkdir "%MiktexRoot%\fonts\tfm\public\itrans" 
mkdir "%MiktexRoot%\fonts\afm\public\itrans" 
mkdir "%MiktexRoot%\fonts\truetype\public\itrans" 
mkdir "%MiktexRoot%\tex\latex\itrans"
mkdir "%MiktexRoot%\tex\latex\itrans\fonts"

rem Copy itrans package files into the MiKTeX structure
rem used http:\\tex.stackexchange.com\questions\1754\tamil-tex-in-windows
rem and the installation script for Tamil-Omega as guides for the copy commands
rem Listed below
rem

rem Copy Documentation files
copy ".\doc\*.*" "%MiktexRoot%\doc\itrans\*.*" /Y /V 
copy ".\contrib\*.*" "%MiktexRoot%\doc\itrans\contrib\*.*" /Y /V 
rem copy Font Files
copy ".\lib\fonts\*.mf"  "%MiktexRoot%\fonts\source\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.pfa" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.pfb" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.pfm" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.tfm" "%MiktexRoot%\fonts\tfm\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.afm" "%MiktexRoot%\fonts\afm\public\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.ttf" "%MiktexRoot%\fonts\truetype\public\itrans\*.*" /Y /V 
rem copy all of the ITRANS Lib structure into MiKTeX structure.
copy ".\lib\*.*" "%MiktexRoot%\tex\latex\itrans\*.*" /Y /V 
copy ".\lib\fonts\*.*" "%MiktexRoot%\tex\latex\itrans\fonts\*.*" /Y /V 

rem post installation commands to rebuilt the font name database ans to process all of the font MAPping files.    
texhash
updmap

rem
rem With the above copies MikTeX can now find the ITRANS fonts and resolve references created by the itrans.exe preprocessor
rem
rem But the preprocessor cannot be run from the command line because itrans.exe is expecting to find a 
rem specific ITRANS structure somewhere on the disk via the environment variable: ITRANSPATH
rem instruct the user about this environment variable requirement
rem

echo "Set the environment variable: ITRANSPATH"
echo "ITRANSPATH=%MiktexRoot%\tex\latex\itrans;%MiktexRoot%\tex\latex\itrans\fonts"

答案3

在 Windows 10 上,首先安装“补充泰米尔字体”,即 Latha 和 Vijaya。(Windows 10 默认使用 Nirmala UI,但效果不佳。)例如,说明可从以下网址获取微软解答。这些说明的简要总结是:设置 -> 系统 -> 应用程序和功能 -> 管理可选功能 -> 添加功能旁边的“+”图标 -> “泰米尔补充字体”。

然后使用 XeLateX 回答问题“在 ShareLaTeX 上用泰米尔语排版”在此网站上,使用 Latha 或 Vijaya 字体。

我用英语和泰米尔语写了一些东西,所以我从这个问题的答案中使用的关键命令是:

\usepackage{polyglossia}
\setmainlanguage{tamil}
\setotherlanguage{english}
\usepackage{fontspec}

以及:\selectlanguage{english} % 此处为一些英文写作 \selectlanguage{tamil} % 此处为一些泰米尔文写作

您还必须使用 \newfontfamily 或 \setmainfont 选择您在第一步中安装的字体(Latha 或 Vijaya)作为渲染泰米尔语时使用的实际字体。

答案4

确实,Xelatex 是最佳选择。还有 Unicode 字体。部分内容请参见:LaTeX/XeTeX 设置泰米尔语/印度语

尝试了一个实验:

泰米尔语

平均能量损失

\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
\usepackage{fontspec}


\setmainfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}\newfontfamily\fpunct{Noto Serif}
\newfontfamily\fdev{Noto Serif Devanagari}
\newfontfamily\englishfont{Noto Serif}

\usepackage{polyglossia}
\setdefaultlanguage[numerals=tamil,changecounternumbering=true]{tamil}
\setotherlanguages{english}

\newcommand\bqql{{\fpunct “\thinspace}}
\newcommand\bqqr{{\fpunct\thinspace ”}}
\newcommand\bql{{\fpunct ‘\thinspace}}
\newcommand\bqr{{\fpunct\thinspace ’}}
\newcommand\bc{{\fpunct ,}}
\newcommand\bend{{\fpunct\textendash\ }}
\newcommand\bemd{{\fpunct\textemdash\  }}
\newcommand\bdanda{{\fdev ।\thinspace}}
\newcommand\bddanda{{\fdev ॥\thinspace}}



\usepackage{tikz}
\usetikzlibrary{shadows.blur}

\newcommand\bframe[1]{%
\begin{tikzpicture}
\node [shade,
      top color=red!40,
      bottom color=violet!5,
      rounded corners=2pt,
      blur shadow={shadow blur steps=5,violet}
    ] {#1};
      \end{tikzpicture}%
}

\usepackage{titlesec}
\titleformat{\section}{\large}{\bframe{\thesection}}{0.75em}{}

\usepackage{titletoc}
\titlecontents{section}
[1em]%left
{}%abovecode
{\bframe{\thecontentslabel}\hspace{0.75em}}%numbered format
{\huge}%numberless format
{\titlerule*[1pc]{.}\contentspage} % page number
[]%belowcode

\begin{document}

\tableofcontents
\vspace{1ex}
\hrule
\vspace{1ex}

\today

\textenglish{From Wikipedia}

\section{சூரியக் குடும்பம்}
கதிரவ அமைப்பு (\textenglish{Solar System}) அல்லது சூரியக் குடும்பம் என்பது கதிரவனுக்கும் அதைச் சுற்றி வரும்  ....
\section{கண்டு பிடிப்பும் ஆய்வுப் பயணமும்}
பல்லாயிரம் ஆண்டுகளாக மனித இனம் கதிரவ அமைப்பைப் பற்றி புரிந்துகொள்ளவோ ஏற்றுக்கொள்ளவோ இல்லை. 
\end{document}

tamildigits.sty(从孟加拉语版本克隆)

\ProvidesPackage{tamildigits}
  [2019/11/11 v.00%
   Formatting of Tamil digits]

\def\tamildigits#1{\expandafter\@tamil@digits #1@}
\def\@tamil@digits#1{%
  \ifx @#1% terminate
  \else%௦௧௨௩௪௫௬௭௮௯
    \ifcase#1௦\or௧\or௨\or௩\or௪\or௫\or௬\or௭\or௮\or௯\fi
    \expandafter\@tamil@digits
  \fi
}
\endinput

gloss-tamil.ldf将泰米尔数字处理(也已克隆)添加到(语言定义文件,其中的一部分)的末尾polyglossia

%===============================

\def\tmp@western{Western}
\newif\iftamil@devanagari@numerals
\tamil@devanagari@numeralsfalse%true
\def\tmp@tamil{tamil}
\newif\iftamil@tamil@numerals
\tamil@tamil@numeralstrue%false %


\define@key{tamil}{numerals}[Devanagari]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western
    \tamil@devanagari@numeralsfalse
  \else\ifx\@tmpa\tmp@tamil
    \tamil@devanagari@numeralsfalse
    \tamil@tamil@numeralstrue\fi
  \fi}

\def\extras@tamil{}
\def\noextras@tamil{}

\define@boolkey{tamil}[tamil@]{changecounternumbering}{
  \def\@tmpa{#1}
  \def\@tmptrue{true}
  \ifx\@tmpa\@tmptrue
    \def\extras@tamil{%
      \let\savethepage\thepage
      \let\savethesection\thesection
      \let\savethesubsection\thesubsection
      \let\savethesubsubsection\thesubsubsection
      \let\savetheparagraph\theparagraph
      \let\savethesubparagraph\thesubparagraph
      \def\thepage{\tamilnumeral{page}}
      \def\thesection{\tamilnumeral{section}}
      \def\thesubsection{\tamilnumeral{subsection}}
      \def\thesubsubsection{\tamilnumeral{subsubsection}}
      \def\theparagraph{\tamilnumeral{paragraph}}
      \def\thesubparagraph{\tamilnumeral{subparagraph}}
    }
    \def\noextras@tamil{%
      \let\thepage\savethepage
      \let\thesection\savethesection
      \let\thesubsection\savethesubsection
      \let\thesubsubsection\savethesubsubsection
      \let\theparagraph\savetheparagraph
      \let\thesubparagraph\savethesubparagraph
    }
  \fi
}

\def\tamilnumber#1{\tamildigits{\number#1}}% Takes number
\def\tamilnumeral#1{\tamilnumber{\csname c@#1\endcsname}}% Takes counter

\def\blockextras@tamil{\extras@tamil}
\def\inlineextras@tamil{\extras@tamil}

一些系统字体的示例:

泰米尔字体样本

平均能量损失

\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
\usepackage{fontspec}


\setmainfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}
\newfontfamily\englishfont{Noto Serif}

\newcommand\ftaname{Baloo Thambi}
\newcommand\ftbname{ETTamilNew}
\newcommand\ftcname{\detokenize{GIST-TMOTPadma}}
\newcommand\ftdname{\detokenize{GIST-TMOTParvathi}}
\newcommand\ftename{SakalBharati}
\newcommand\ftfname{\detokenize{TSCu_SaiIndira}}

\newfontface\fta{\ftaname}
\newfontface\ftb{\ftbname}
\newfontface\ftc{\ftcname}
\newfontface\ftd{\ftdname}
\newfontface\fte{\ftename}
\newfontface\ftf{\ftfname}

\newcommand\sampletext{சூரியக் குடும்பம்}


\usepackage{polyglossia}
\setdefaultlanguage[numerals=tamil,changecounternumbering=true]{tamil}
\setotherlanguages{english}


\begin{document}
\begin{tabular}{rl}
\textenglish{\ftaname} & \huge\fta\sampletext \\
\textenglish{\ftbname} & \huge\ftb\sampletext \\
\textenglish{\ftcname} & \huge\ftc\sampletext \\
\textenglish{\ftdname} & \huge\ftd\sampletext \\
\textenglish{\ftename} & \huge\fte\sampletext \\
\textenglish{\ftfname} & \huge\ftf\sampletext \\
\end{tabular}

\end{document}

还有字体效果:

字体效果

平均能量损失

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{fontspec}
\setmainfont{Noto Serif}[Scale=3]
\usepackage{contour}
\usepackage{shadowtext}

\newcommand\sampletext{சூரியக்}
\newcommand\sampletextb{குடும்பம்}
\newcommand\sampletextc{அமைப்பு}
\newcommand\ftcname{\detokenize{GIST-TMOTPadma}}
\newfontface\ftc{\ftcname}[Scale=3]

\begin{document}
\contourlength{1.4pt}
\shadowcolor{blue}
\shadowoffsetx{1.52pt}
\shadowoffsety{1.52pt}
\Huge
\shadowtext{%
\contour[32]{yellow}{%
\textbf{{\ftc\sampletext}}
}%
}%

\bigskip

\contourlength{0.4pt}
\color{yellow}
\shadowcolor{blue}
\shadowoffsetx{0.52pt}
\shadowoffsety{0.52pt}
\Huge
\shadowtext{%
\contour[24]{red}{%
\textbf{{\ftc\sampletextb}}
}%
}%

\bigskip

\contourlength{0.8pt}
\color{Magenta}
\shadowcolor{blue!40}
\shadowoffsetx{4.52pt}
\shadowoffsety{2.52pt}
\Huge
\shadowtext{%
\contour[24]{red}{%
\ftc\sampletextc
}%
}%


\end{document}

相关内容