latex3 / babel

The multilingual framework to localize LaTeX, LuaLaTeX and XeLaTeX
https://latex3.github.io/babel/
LaTeX Project Public License v1.3c
130 stars 35 forks source link

Enhancements for Japanese #111

Closed jbezos closed 1 year ago

jbezos commented 3 years ago

As discussed here: https://github.com/texjporg/babel-japanese/issues/3 .

jbezos commented 3 years ago

With the version currently in GitHub if I add to japanese.ldf the following:

\setlocalecaption{\CurrentOption}{chapter.template}%
  {[[prechapter]] [chapter] [[postchapter]]}

and with the following document:

\documentclass{book}
\usepackage[japanese]{babel}
\babelfont{rm}{IPAexMincho}
\begin{document}
\chapter{Blah}
\end{document}

I get jap1

If I then modify the latter as follows:

\documentclass{book}
\usepackage[japanese]{babel}
\babelfont{rm}{IPAexMincho}
\babelprovide[labels=map, labels/arabic.map = informal]{japanese}
\setlocalecaption{japanese}
  {chapter.template}
  {[[prechapter]][chapter][[postchapter]]}
\begin{document}
\chapter{Blah}
\end{document}

I get jap2

aminophen commented 3 years ago

Thanks!

Could you tell me how to detect whether this feature is available or not? I'd like to add

\if<something>
\setlocalecaption{\CurrentOption}{part.template}%
  {[[prepart]] [part] [[postpart]]}
\setlocalecaption{\CurrentOption}{chapter.template}%
  {[[prechapter]] [chapter] [[postchapter]]}
\fi

into japanese.ldf.

Another issue I have is that the opposite format change is not available. For example, ltjbook.cls is a Japanese class which already has a format of [[prechapter]] [chapter] [[postchapter]]. In this case, \usepackage[english]{babel} cannot change the format. If we could avoid such a problem by using \usepackage[japanese,english]{babel}, it would be useful too.

jbezos commented 3 years ago

\ifx\setlocalecaption\@undefined should work, to avoid an error. But those two settings will be just ignored in the current published version (well, not quite, but the internal changes are harmless).