7

I am using TeX, with the macro package AmS-TeX. I'd like to use it with the Italian language, so that words are hyphenated the right way (e.g. the Italian word 'distante' should be broken as di-stante; TeX instead breaks it as dis-tante, like it would break the English word 'distant').

In addition, is it possible to switch between different languages in the same document? If so, then how?

I have found solution to this problem only for LaTeX; I need, instead, a solution for TeX.

  • Welcome to TeX.SX (from another Italian fellow)! Are you really sure you want to use a format which has been dead for several years? – egreg Dec 23 '13 at 11:12
  • 1
    wow amstex, archaeology in action:-) – David Carlisle Dec 23 '13 at 11:18
  • Thank you for the welcome. I'm learning TeX and I want to use a 'format' which is best suitable for mathematical writings. (I don't like LaTeX.) Do you think plain TeX or other formats should be better using? What do you suggest me? – User Dec 23 '13 at 13:40
  • Luatex (which should be Amstex compatible) offers support for using several different hyphenation dictionaries with a document that may provide a solution that is probably rather easier than @egreg's solution. I'd post an answer, but I have no experience with this; take a look at section 4.7 of the refman: luatex.org/svn/trunk/manual/luatexref-t.pdf – Charles Stewart Dec 23 '13 at 14:24
10

First part of the procedure

This procedure assumes you're running TeX Live on a Unix box.

  1. Go in a working directory just to be sure you don't overwrite anything.

  2. Prepare a file bplain.cnf containing the line

    bplain pdftex language.dat -translate-file=cp227.tcx *bplain.ini
    
  3. Run the following command line

    fmtutil --cnffile bplain.cnf --fmtdir . --all
    
  4. Do the command

    mv pdftex/bplain.fmt .
    
  5. Process the test file matteo.tex shown below with

    pdftex -fmt bplain -output-format pdf matteo
    

Here is the test file

% test file matteo.tex
% activate italian
\language\csname l@italian\endcsname
\lccode`'=`'
\righthyphenmin=2
%%%

\overfullrule=0pt % just for the example

\input amstex
\documentstyle{amsppt}

\topmatter
\title A paper\endtitle
\author Matteo\endauthor
\endtopmatter

\document

\vbox{\hsize=3pt\hskip0pt % show some hyphenations
 distante
 amicizia
 dell'amicizia
 ricordo
}

\enddocument

And here is the output

enter image description here

Now you can move bplain.fmt in some place where TeX Live can find it; for instance

~/texmf/web2c/pdftex

(or ~/Library/texmf/web2c/pdftex on Mac OS X). The command line above will work from any directory.

If you're bold, steps 3 and 4 and the final move of bplain.fmt file can be done in one step by

fmtutil --cnffile bplain.cnf --fmtdir $(kpsewhich -var-value TEXMFHOME) --all

Second part of the procedure

Now you should have a working setup. Add the following alias to your .bashrc file:

alias bpdftex='pdftex -fmt bplain -output-format pdf'

and, when you'll open a new shell, you'll be able to run

bpdftex matteo

A more complicated example file showing how to switch languages:

\catcode`@=11
\def\italian{%
  \language\l@italian
  \lccode`'=`'
  \righthyphenmin=2
}
\def\english{%
  \language\l@english
  \lccode`'=0
  \righthyphenmin=3
}
% you can add other languages, if you want
\catcode`@=12
\english % initialization
%%%

\overfullrule=0pt % just for the example

\input amstex
\documentstyle{amsppt}

\topmatter
\title A paper\endtitle
\author Matteo\endauthor
\endtopmatter

\document

% this will use English hyphenation
\vbox{\hsize=3pt\hskip0pt % show some hyphenations
 distance
 pleasure
 confidential
 record
}

\medskip\hrule\smallskip

\italian % this will use Italian hyphenation
\vbox{\hsize=3pt\hskip0pt % show some hyphenations
 distante
 amicizia
 dell'amicizia
 ricordo 
}

\enddocument

enter image description here

Third part of the procedure

Switch to LaTeX

  • The command fmtutil --cnffile bplain.cnf --fmtdir . --all doesn't work – User Dec 23 '13 at 13:45
  • It says: fmtutil: config file `bplain.cnf' not found (ls-R missing?). – User Dec 23 '13 at 13:46
  • @Matteo Oh, sorry, I wrote the file name wrongly! Check the fixed answer. – egreg Dec 23 '13 at 13:52
  • I haven't saved any bplain.cnf: you haven't said me to do it. I've only created the file matteo.cnf – User Dec 23 '13 at 13:55
  • @Matteo I changed the file name; it should be bplain.cnf, not matteo.cnf – egreg Dec 23 '13 at 13:55
1

You may also try egreg's hyplain as a format for Plain TeX. It requires only three files to install, and the documentation is a two page leaflet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.