如何设置连字的最小字符数?

如何设置连字的最小字符数?

(与我的另一个问题相关这里。)看来,梵语音译的多语连字规则默认允许在单个字符后连字。看这个例子,ulūkādayaḥ第三行和第四行之间的单词只在一个字符后连字。我怎样才能将其改为,例如,两个字符?

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{sanskrit}
\newfontfamily\sanskritfont{TeX Gyre Pagella}

\setotherlanguage{english} 
\newfontfamily\englishfont{TeX Gyre Pagella}

\begin{document}

asmadādiviśeṣaṇaśūnyasyārthasākṣātkāritvamātrasyaivendriyādhīnatvadarśanād anaikāntikatvam asambhavīti cet | yady evam arthasākṣātkāritvamātrasyendiryavadālokādhīnatvam upalabdham iti na santamase paśyeyur ulūkādayaḥ | atha vyabhicāradarśanād ālokasyāvyāpakatvam, vyabhicāraśaṅkayā tarhīndriyasyāpy avyāpakatvam | vyāptyā śaṅkā khaṇḍyata iti cet | śaṅkāsambhavād vyāptir evāsambhavinī yadi prathamata eva vyāptiḥ, vyabhicāro 'pi na dṛśyeta | 


\end{document}

示例输出

编辑:我还是不太明白。我现在正尝试将两端的最小连字符数减少为一个:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\tracingparagraphs=1
\setdefaultlanguage{sanskrit}
\setotherlanguage{english}

\PolyglossiaSetup{sanskrit}{
  hyphenmins={1,1},
}

\newfontfamily\sanskritfont{TeX Gyre Pagella}
\newfontfamily\englishfont{TeX Gyre Pagella}

\begin{document}

anaikāntikatvam asambhavīti cet | yady evam arthasākṣātkāritvamātrasyendiryavadālokādhīnatvam upalabdham iti na santamase xx paśyeyur ulūkādayaḥ | atha vyabhicāradarśanād ālokasyāvyāpakatvam, vyabhicāraśaṅkayā tarhīndriyasyāpy avyāpakatvam | vyāptyā śaṅkā khaṇḍyata iti cet | śaṅkāsambhavād vyāptir evāsambhavinī yadi prathamata eva vyāptiḥ, vyabhicāro 'pi na dṛśyeta | 


\end{document}

并得到以下输出:

在此处输入图片描述

令我惊讶的是,它没有用连字符连接生成过满的 \hbox 的单词,这是我所期望的khaṇḍya-ta

在日志文件中:

@firstpass
@secondpass
[]\EU1/TeXGyrePagella(0)/m/n/12 anaikāntikatvam a-sa-mbha-vīti cet | yady e-vam
 a-rtha-sā-kṣā-tkā-ri-tva-mā-
@\discretionary via @@0 b=12 p=50 d=2984
@@1: line 1.2- t=2984 -> @@0
tra-sye-ndi-rya-va-dā-lo-kā-dhī-na-tvam u-pa-la-bdham iti na sa-nta-mase xx pa-
śye-
@\discretionary via @@1 b=26 p=50 d=13796
@@2: line 2.1- t=16780 -> @@1
yur u-lū-kā-da-yaḥ | a-tha vya-bhi-cā-ra-da-rśa-nād ā-lo-ka-syā-vyā-pa-ka-tvam,
 vya-
@\discretionary via @@2 b=56 p=50 d=16856
@@3: line 3.1- t=33636 -> @@2
bhi-cā-ra-śa-ṅkayā ta-rhī-ndri-ya-syāpy a-vyā-pa-ka-tvam | vyā-ptyā śa-ṅkā kha-
ṇḍyata 
@ via @@3 b=* p=0 d=*
@@4: line 4.3 t=33636 -> @@3
iti cet | śa-ṅkā-sa-mbha-vād vyā-ptir e-vā-sa-mbha-vinī yadi pra-tha-mata eva v
yā-
@\discretionary via @@4 b=31 p=50 d=4181
@@5: line 5.3- t=37817 -> @@4
ptiḥ, vya-bhi-cāro 'pi na dṛśyeta | 
@\par via @@5 b=0 p=-10000 d=*
@@6: line 6.2- t=37817 -> @@5

我发现它通常不想在最后一个音节之前连字符,为什么会这样?

答案1

你可以加

\PolyglossiaSetup{sanskrit}{
  hyphenmins={2,3},% default is {1,3}
}

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{sanskrit}
\setotherlanguage{english}

\PolyglossiaSetup{sanskrit}{
  hyphenmins={1,3},
}

\newfontfamily\sanskritfont{TeX Gyre Pagella}
\newfontfamily\englishfont{TeX Gyre Pagella}

\begin{document}

asmadādiviśeṣaṇaśūnyasyārthasākṣātkāritvamātrasyaivendriyādhīnatvadarśanād anaikāntikatvam asambhavīti cet | yady evam arthasākṣātkāritvamātrasyendiryavadālokādhīnatvam upalabdham iti na santamase paśyeyur ulūkādayaḥ | atha vyabhicāradarśanād ālokasyāvyāpakatvam, vyabhicāraśaṅkayā tarhīndriyasyāpy avyāpakatvam | vyāptyā śaṅkā khaṇḍyata iti cet | śaṅkāsambhavād vyāptir evāsambhavinī yadi prathamata eva vyāptiḥ, vyabhicāro 'pi na dṛśyeta | 


\end{document}

在此处输入图片描述

答案2

这篇文章引发了github 问题,他们将其关闭为 wontfix。但随后的帖子确实提到了几种解决方法:

  1. \providehyphenmins{sanskrit}{11}提前致电\setdefaultlanguage{sanskrit}
  2. 将宏设置\sanskrithyphenmins11providecommand之前\setdefaultlanguage{sanskrit}renewcommand之后)
  3. 称呼
\lefthyphenmin=1
\righthyphenmin=1

之后\begin{document}\AtBeginDocument不会起作用,etoolboxAfterEndPreamble会起作用)。“但是这会在任何语言更改时被覆盖。”

方法2的示例:

\documentclass{article}

\usepackage[width=4.4in]{geometry}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{sanskrit}
\renewcommand*{\sanskrithyphenmins}{11}
\setotherlanguage{english}

\PolyglossiaSetup{sanskrit}{} % still necessary

\begin{document}

anaikāntikatvam asambhavīti cet | yady evam arthasākṣātkāritvamātrasyendiryavadālokādhīnatvam upalabdham iti na santamase xx paśyeyur ulūkādayaḥ | atha vyabhicāradarśanād ālokasyāvyāpakatvam, vyabhicāraśaṅkayā tarhīndriyasyāpy avyāpakatvam | vyāptyā śaṅkā khaṇḍyata iti cet | śaṅkāsambhavād vyāptir evāsambhavinī yadi prathamata eva vyāptiḥ, vyabhicāro 'pi na dṛśyeta | 

\end{document}

导致:

示例的输出

相关内容