5

This question is concerned about writing a non-english document in LaTeX.

I compile my Hebrew document with pdfLaTeX. I know, XeLaTex or LuaLaTeX with the polyglossia package are Unicode engines, and are the recommended engines for non-Latin scripts. But I decided to stick to pdfLaTeX for its other useful features.

As I learned here, one can declare the Hebrew glyphs in the preamble, thus defining behavior for Unicode characters:

\documentclass{article} \usepackage[T1]{fontenc} % Specifies which font encoding LATEX should % use, (8-bit encoding (T1)) \usepackage[utf8]{inputenc} % Translate various standard and other % input encodings into a ‘LaTeX internal language‘ \usepackage{culmus} % Hebrew fonts from the Culmus project \usepackage[main=english, hebrew]{babel} % Multilingual support, % typographical (and other) rules \pdfmapfile{=culmus.map} % pdflatex now reads the file culmus.map, % which tells pdflatex how to get the font into the output file %% Declarations %% \DeclareUnicodeCharacter{05D0}{\hebalef} \DeclareUnicodeCharacter{05D1}{\hebbet} \DeclareUnicodeCharacter{05D2}{\hebgimel} % and so on, up to \DeclareUnicodeCharacter{05EA}{\hebtav} %% Document %% \begin{document} כיתוב בעברית \end{document} 

Now comes my question: I want to write down these 27 declarations in a separate file (probably a .sty or a .def file?) so as to make my preamble cleaner.

What is the correct way to do that?

What command should I pass to my latexmkrc file so that pdfLaTeX searches there for the declarations list?

Does the inputenx package can do this for me? If yes, then what argument should I pass to \usepackage[...]{inputenx}?

Any suggestion or help would be much appreciated.

7
  • Out of curiosity, which features of PDFTeX did you need? Commented Mar 16, 2021 at 2:27
  • A good approach is to stick all the Hebrew set-up in a .sty file. Commented Mar 16, 2021 at 2:28
  • 2
    if you create such a list the best is to call it lheenc.dfu. Then it will be loaded automatically. If it is complete you could upload to ctan. Put it in a texmf tree e.g. in tex/latex/hebrew-unicode. Commented Mar 16, 2021 at 8:52
  • @ Davisor, XeTeX includes some of the pdfTeX primitives, but not currently all of them. Commented Mar 16, 2021 at 9:08
  • @Ulrike Fischer sorry, could you elaborate a bit about the path for the file? If I compile my project in overleaf, where should the file be saved inside my project? What command should be passed to a latexmkrc file? Commented Mar 16, 2021 at 16:26

1 Answer 1

2

I think that a possible solution is to write the declarations in an external .sty file, and call it from the preamble.

% file hebrewDeclarations.sty %% Declarations %% \DeclareUnicodeCharacter{05D0}{\hebalef} \DeclareUnicodeCharacter{05D1}{\hebbet} \DeclareUnicodeCharacter{05D2}{\hebgimel} % and so on, up to \DeclareUnicodeCharacter{05EA}{\hebtav} 

Whereas the tex file is:

\documentclass{article} \usepackage[T1]{fontenc} % Specifies which font encoding LATEX should % use, (8-bit encoding (T1)) \usepackage[utf8]{inputenc} % Translate various standard and other % input encodings into a ‘LaTeX internal language‘ \usepackage[main=english, hebrew]{babel} % Multilingual support, % typographical (and other) rules \usepackage{hebrewDeclarations} % Reference to the external sty file %% Document %% \begin{document} כיתוב בעברית \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.