Tx · LaTeX & TikZ

Fix “cp1255.def not found” in LyX on Windows

Published By the 9to5Science editorial team

At a glance

  1. 1. Check the encoding

    Find whether LyX is generating a request for Windows-1255 input encoding.

  2. 2. Prefer UTF-8

    Set the document to UTF-8 and resave it; this avoids relying on cp1255.def.

  3. 3. Choose a Hebrew-capable engine

    For reliable Hebrew typesetting, use XeLaTeX or LuaLaTeX with a Hebrew font.

  4. 4. Update TeX packages

    If you must keep Windows-1255, check your TeX distribution for the missing encoding definition and Hebrew support.

Advertisement

The message cp1255.def not found comes from the LaTeX compilation step, not from LyX’s editor itself. It means the document or LyX has requested the Windows-1255 character encoding, but the TeX installation cannot find the definition file that handles it.

For a new or editable document, use UTF-8 instead. It is the standard choice for Hebrew and other languages, and it avoids a dependency on a legacy Windows code page. For Hebrew typesetting, XeLaTeX or LuaLaTeX is generally the easiest route because these engines work directly with Unicode text and system fonts.

What triggers the error

A LaTeX document using an 8-bit encoding may contain a line like:

\usepackage[cp1255]{inputenc}

That tells LaTeX to interpret the source text as Windows-1255. LaTeX then looks for cp1255.def. If the file is absent from the installed TeX packages, compilation stops. The message does not necessarily mean the Hebrew text itself is invalid.

LyX creates the LaTeX source from its document settings. A document saved with an older encoding, or a preamble copied from another project, can therefore request cp1255 even if you no longer need it.

In LyX, open the document’s settings and check its language and input encoding. Set the language to Hebrew where appropriate, and choose UTF-8 as the document encoding. The exact menu wording varies by LyX version. Save the document after changing the setting.

Then select XeLaTeX or LuaLaTeX as the output engine in LyX’s output settings. Use a font installed on your Windows system that includes Hebrew glyphs. For example, the following standalone LaTeX document illustrates the XeLaTeX approach; it requires the fontspec and polyglossia packages and the Arial font to be installed:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}

\begin{document}
שלום עולם
\end{document}

Compile this example with XeLaTeX, not pdfLaTeX. In LyX, the equivalent setup is to select Hebrew as the document language, enable the XeTeX/LuaTeX font workflow in the document’s font settings, and ensure the chosen font is available to Windows. LyX versions label these settings differently, so check the settings panels for your installed version.

If you must keep Windows-1255

First update your TeX distribution, but do not assume a routine update will provide this file: cp1255 is not commonly supplied as a standard inputenc definition. Check the distribution’s documentation and package manager for a package that explicitly provides this encoding definition and any needed Hebrew support. On MiKTeX, use MiKTeX Console to update packages and check for missing-package prompts. On TeX Live, update the installation with its package manager. If no documented provider is available, converting the document to UTF-8 is the practical route.

If the file is still missing, inspect the LaTeX source LyX generated for the document. Look for cp1255 in the preamble and confirm that Windows-1255 is actually the intended encoding. If the source is already UTF-8, remove or correct an obsolete inputenc request rather than converting the text to Windows-1255. Do not download a random cp1255.def file from an unverified site: an encoding definition must match the packages and character mappings expected by your TeX installation.

Check what LyX is compiling

When the error persists after changing settings, use LyX’s LaTeX log or view the generated LaTeX source. Search for cp1255 to identify which setting or preamble line is requesting it. Also check the first reported error: a missing Hebrew language or font package can produce a different problem that appears after the encoding issue is fixed.

A useful diagnosis is:

What you findWhat to do
\\usepackage[cp1255]{inputenc} in the preambleChange the source encoding to UTF-8 and remove or correct the cp1255 request, or install a documented package that provides the definition.
UTF-8 document, but an old cp1255 line remainsRemove or correct the obsolete preamble setting.
No cp1255 in the sourceCheck the full log and LyX’s generated files; another included file or class may request it.

Common mistakes

  • Changing only the document language: Hebrew language selection and the input-file encoding are different settings. Set both appropriately.
  • Compiling Unicode Hebrew with pdfLaTeX and an old code page: This can lead to further character or font errors even after the missing file is addressed.
  • Assuming LyX is the missing component: LyX generates LaTeX; the TeX distribution supplies the files LaTeX needs.
  • Editing generated LaTeX instead of the LyX document: LyX may regenerate that source on the next export. Change the document settings or its explicit preamble instead.

References

  1. The LaTeX Project: inputenc package
  2. CTAN: polyglossia package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.