TransWikia.com

Unable to compile no matter the package

TeX - LaTeX Asked by ficonni on January 8, 2021

I am a first time user and no matter how hard I try I am unable to compile the work into a PDF. To check if my work is not at fault I borrowed an example used to test Serbian output (I have a need to write in the Serbian Latin , preferebly directly with UTF-8 output and I suspected this to be the issue until I had the exact same situation with English fonts only). Here’s the example .tex file and the answer I get in the terminal below:

documentclass[utf8]{article}
usepackage{inputenc}
title{Mačak u vreći}
author{Pero Perić}

begin{document}
maketitle

section{Probni znakovi}
šđžčć ŠĐŽČĆ

end{document}

And here is the output I get in Xetec (same as in Luatex)

     [filip@tux Latex learning]$ xetex 1.tex
     This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 
     2019/dev/Debian) (preloaded format=xetex)
     restricted write18 enabled.
     entering extended mode
     (./1.tex
     ! Undefined control sequence.
     l.1 documentclass
              [utf8]{article}
     ?

Apologies if it’s my lack of basic Google skills, but I found no answer for something like this. It also should be pointed out that no matter the documentclass or inputclass or any other command put, the output for the error in the terminal is always the Undefined control sequence.

I am using Vim as my text editor.

2 Answers

You need to use xelatex rather than xetex. Likewise, lualatex instead of luatex.

When you run xetex, it loads with the plain TeX format that doesn't include the LaTeX definitions so you get the error that you encountered.

Correct answer by Don Hosek on January 8, 2021

As supplement to nice @Don Hosek answer (+1).

With use of the pdfLaTeX engine, you need to declare font encoding, i.e. T1 which support all "probne znakove":

Edit:

  • Option [utf8] in the documentclass is not defined, consequently using it you receive warning: Unused global option(s): [utf8]. Correctly you should write:
documentclass{article}
usepackage[utf8]{inputenc}
  • LaTeX version after April 2018 LATEX News has default utf8 encoding, so you can dropout usepackage[utf8]{inputenc}
  • The default LaTeX font encoding is OT1, the encoding of the original Computer Modern fonts, which not define letter đ (dj), consequently in your case you receive error Command dj unavailable in encoding OT1 using LaTeX or pdfLaTeX compiler. Using them, this error is removed with use of T1 input encoding:
documentclass{article}
usepackage[T1]{fontenc}  % <---
title{Mačak u vreći}
author{Pero Perić}

begin{document}
maketitle

section{Probni znakovi}
šđžčć ŠĐŽČĆ

end{document}

enter image description here

  • using XeLaTeX and luaLaTeX you not need T1 encoding.

Answered by Zarko on January 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP