Add lang=DE|IT|JA package options (Feature #2)


Added by Alexis Bienvenüe over 10 years ago. Updated over 10 years ago.


Status:Closed Start date:02/14/2012
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:LaTeX
Target version:1.1.0

Description

Currently, only FR and ES languages are supported by the automultiplechoice LaTeX package lang option.
Add DE and IT.


DOC-filtered.tex - Sample filtered Japanese source (817 Bytes) Alexis Bienvenüe, 03/19/2012 02:24 pm

DOC-filtered.pdf (32.6 kB) Hiroto Kagotani, 03/19/2012 03:16 pm


History

Updated by ChiliProject Admin over 10 years ago

  • Category set to LaTeX

Updated by Hiroto Kagotani over 10 years ago

Additionally, I would like JA (Japanese) support.
The following is the JA localized text.

\def\AMC@loc@JA{
  \def\AMC@loc@draft{ドラフト}
  \def\AMC@loc@message{試験の実施には、auto-mutiple-choiceでコンパイルされた文書を印刷してください。}
  \def\AMC@loc@qf##1{\textbf{問##1:}}
  \def\AMC@loc@q##1##2{\textbf{問##1} ##2}
  \def\AMC@loc@corrected{模範解答}
  \def\AMC@loc@catalog{問題カタログ}
  \def\AMC@loc@none{該当なし。}
}

Updated by Alexis Bienvenüe over 10 years ago

Thank you very much. Is it possible to use pdflatex to make a Japanese document, or is it necessary to use xelatex? If xelatex is required, I will add a little code to print an error in case latex is used with lang=JA option.

  • Subject changed from Add lang=DE|IT package options to Add lang=DE|IT|JA package options

Updated by Hiroto Kagotani over 10 years ago

Thanks.

In fact, latex environment for Japanese text is a little bit complicated.

Pdflatex does not handle Japanese text.
Xelatex does with some font settings in the preamble of the source and additional font installation, but it does not handle completely Japanese spacing and line breaking.
Usually, latex users in Japan use "platex" + dvipdfmx, which are distributed with TeXLive2011. Older version of platex is also used by some people, but it does not have \pdfsavepos feature and does not handle UTF-8 encoding.

Further, ghostscript does not handle PDF produced by dvipdfmx with standard font settings; Japanese fonts must be embedded in PDF.

For these reasons, in order to fully support Japanese text, some additional documentation for Japanese users will be required.

I am providing materials step by step from easier ones. The easiest one is the lang=JA option for automultiplechoice package. The second may be GUI translation. And so on...

Updated by Alexis Bienvenüe over 10 years ago

Thank you for your explanation, and for your work. I include your patch as is.

Perhaps it could be also interesting (and not too difficult) to amend the AMC-TXT "filter" (available in development versions of AMC, see included documentation) to allow Japanese exams to be handled without LaTeX knowledge? If you think this is interesting and if you have a little time, look at a DOC-filtered.tex made by the AMC-TXT filter for an english exam and see if some little changes could make it usable for Japanese texts.

Updated by Hiroto Kagotani over 10 years ago

I tested AMC-TXT filter feature and looked in DOC-filtered.tex.
Then I found some slight modification made the feature available for Japanese exam.

  • use "platex+dvipdfmx" instead of xelatex.
  • xltxtra package must not be used.
  • font option (\setmainfont) must not be used. ("Linux Libertine O" is implicitly specified by default)
Here are some related things:
  • Can't I enter my favorite LaTeX engine in preferences window? I could do it with AMC-1.0.3.
  • Changing source file format does not change source file name (extention). Is there any way to change source file name?

Also, I misspelled the program name in the Japanese text at \AMC@loc@message above.
Please correct "auto-mutiple-choice" to "auto-multiple-choice" in the latex package file.

Updated by Alexis Bienvenüe over 10 years ago

Thank you for your help.

Can't I enter my favorite LaTeX engine in preferences window? I could do it with AMC-1.0.3.

When preparing working documents, the AMC-TXT filter sets (overwrite, if this setting was already set by the user) the engine to xelatex since the produced LaTeX file is made to work with xelatex. I propose the following:
  • when using "Lang: JA" option, set the (default) engine to "platex+dvipdfmx" instead
  • add an option LaTeXEngine: to overwrite if needed
  • grey out the corresponding entry in the edit/preferences window
  • xltxtra package must not be used.
  • font option (\setmainfont) must not be used. ("Linux Libertine O" is implicitly specified by default)

I will remove these for JA exams (setting default Font: to empty for the second).

Changing source file format does not change source file name (extention). Is there any way to change source file name?

Since revision r927, the filename is changed only for new projects created with empty source file and in the case the file has not yet been edited. Maybe I should add a button to change the source file name...

Please correct "auto-mutiple-choice" to "auto-multiple-choice" in the latex package file.

Yes, thanks.

Updated by Alexis Bienvenüe over 10 years ago

Could you post a Japanese AMC-TXT sample file so that I can make some tests?

Updated by Hiroto Kagotani over 10 years ago

Here is the sample.

# AMC-TXT file
Title: 試験タイトル(Paper title)
Lang: JA
Font:

* カメルーンの首都はどれですか?(Which is the capital city of Cameroon?)
+ ヤウンデ(Yaounde)
- ドゥアラ(Douala)
- クリビ(Kribi)

Updated by Alexis Bienvenüe over 10 years ago

My platex fails with

! Undefined control sequence.
l.27 \unless
                      \collect@body

and
! Undefined control sequence.
\AMC@traceposy ...pty #1\@empty \else \pdfsavepos
                                                  \protected@write \AMC@XYFI...

Maybe I have an outdated version of platex? Or am I missing something?
This is pTeXk, Version 3.141592-p3.1.11 (euc) (Web2C 7.5.4)
 %&-line parsing enabled.
pLaTeX2e <2006/11/10>+0 (based on LaTeX2e <2009/09/24> patch level 0)

Updated by Hiroto Kagotani over 10 years ago

Maybe I have an outdated version of platex?

I'm afraid yes.
My platex prints the following message and successfully processes your DOC-filtered.tex and dvipdfmx produced the attached PDF.

This is e-pTeX, Version 3.1415926-p3.2-110825-2.3 (utf8.euc) (TeX Live 2011) (format=platex 2012.3.2) 19 MAR 2012 22:33
(snip)
pLaTeX2e <2006/11/10> (based on LaTeX2e <2011/06/27> patch level 0)

Someone wrote on his blog that platex in Debian's stable packages was outdated but recently they updated experimental packages for TeXLive (with new platex) at:
http://packages.debian.org/en/experimental/tex/
(http://wiki.debian.org/DebianExperimental)
Please have a try on texlive-lang-cjk and other related packages.

Updated by Alexis Bienvenüe over 10 years ago

Thanks very much for the links. I installed a vanilla texlive 2011 in a debian virtual machine and now it works well... I will have to wait a little for the new package in experimental to enter unstable or testing.

So we can try the filter with Japanese exams starting from revision r934.

Updated by Hiroto Kagotani over 10 years ago

Revision r934 works very well for my AMC-TXT format exam
(except for graying out the latex engine entry).
Thank you!

Updated by Alexis Bienvenüe over 10 years ago

(except for graying out the latex engine entry).

Yes I forgot this. It should be ok since revision r936.

Updated by Alexis Bienvenüe over 10 years ago

Applied in changeset r988.

  • % Done changed from 0 to 100
  • Status changed from New to Resolved

Updated by Alexis Bienvenüe over 10 years ago

  • Status changed from Resolved to Closed

Updated by Alexis Bienvenüe over 10 years ago

Someone wrote on his blog that platex in Debian's stable packages was outdated but recently they updated experimental packages for TeXLive (with new platex)

New TeXlive packages are now available in debian testing, so that AMC is working with Japanese exams. That's great!

Also available in: Atom PDF