2

I have a problem with verbatim, it can't read my Serbian language symbols like č, ć, ž, š, đ.

If I try

\begin{verbatim}
č,ć,ž,š,đ 
\end{verbatim}

I get blank space, also if I try with \v{c},\'{c},\v{z},\v{s},\dj{} (this code is for normal text of č, ć, ž, š, đ in TeX) in verbatim, I get

\v{c},\'{c},\v{z},\v{s},\dj{}

instead of

č,ć,ž,š,đ.

I use Overleaf , and after answer i get here i update my usepackage

    \documentclass[12pt,leqno, style=sailor,
    display=slides,
    paper=smartboard,
    orient=landscape]{article}



\usepackage{listings}
\lstnewenvironment{code}{%
\lstset{frame=single,escapeinside=`',
  backgroundcolor=\color{yellow!20},
  basicstyle=\footnotesize \ttfamily}
}{}




%\usepackage{latexsym}
%\usepackage{odj}
%\usepackage{lscape}
%\usepackage[landscape]{geometry}

\usepackage[rightcaption]{sidecap}
\usepackage{wrapfig}
\usepackage{graphicx}
%\usepackage[pdftex]{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[pdflatex]{xcolor}
\usepackage{multicol}
\usepackage[active]{srcltx}
\usepackage{pifont}
\usepackage{amsmath}
\usepackage{gensymb}


\setlength{\topmargin}{-2cm}
\setlength{\oddsidemargin}{-0.3cm}
\setlength{\evensidemargin}{0cm}
\setlength{\textheight}{23.7cm}
\setlength{\textwidth}{17.5cm}


%%%%%%%%%%%%%%%% COLOR DEFINITION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\definecolor{GreenYellow}   {cmyk}{0.15,0,0.69,0}
\definecolor{Yellow}        {cmyk}{0,0,1,0}
\definecolor{Goldenrod}     {cmyk}{0,0.10,0.84,0}
\definecolor{Dandelion}     {cmyk}{0,0.29,0.84,0}
\definecolor{Apricot}       {cmyk}{0,0.32,0.52,0}
\definecolor{Pea\v{c}}         {cmyk}{0,0.50,0.70,0}
\definecolor{Melon}         {cmyk}{0,0.46,0.50,0}
\definecolor{YellowOrange}  {cmyk}{0,0.42,1,0}
\definecolor{Orange}        {cmyk}{0,0.61,0.87,0}
\definecolor{BurntOrange}   {cmyk}{0,0.51,1,0}
\definecolor{Bittersweet}   {cmyk}{0,0.75,1,0.24}
\definecolor{RedOrange}     {cmyk}{0,0.77,0.87,0}
\definecolor{Mahogany}      {cmyk}{0,0.85,0.87,0.35}
\definecolor{Maroon}        {cmyk}{0,0.87,0.68,0.32}
\definecolor{BrickRed}      {cmyk}{0,0.89,0.94,0.28}
\definecolor{Red}           {cmyk}{0,1,1,0}
\definecolor{OrangeRed}     {cmyk}{0,1,0.50,0}
\definecolor{RubineRed}     {cmyk}{0,1,0.13,0}
\definecolor{WildStrawberry}{cmyk}{0,0.96,0.39,0}
\definecolor{Salmon}        {cmyk}{0,0.53,0.38,0}
\definecolor{CarnationPink} {cmyk}{0,0.63,0,0}
\definecolor{Magenta}       {cmyk}{0,1,0,0}
\definecolor{VioletRed}     {cmyk}{0,0.81,0,0}
\definecolor{Rhodamine}     {cmyk}{0,0.82,0,0}
\definecolor{Mulberry}      {cmyk}{0.34,0.90,0,0.02}
\definecolor{RedViolet}     {cmyk}{0.07,0.90,0,0.34}
\definecolor{Fu\v{c}sia}       {cmyk}{0.47,0.91,0,0.08}
\definecolor{Lavender}      {cmyk}{0,0.48,0,0}
\definecolor{Thistle}       {cmyk}{0.12,0.59,0,0}
\definecolor{Or\v{c}id}        {cmyk}{0.32,0.64,0,0}
\definecolor{DarkOr\v{c}id}    {cmyk}{0.40,0.80,0.20,0}
\definecolor{Purple}        {cmyk}{0.45,0.86,0,0}
\definecolor{Plum}          {cmyk}{0.50,1,0,0}
\definecolor{Violet}        {cmyk}{0.79,0.88,0,0}
\definecolor{RoyalPurple}   {cmyk}{0.75,0.90,0,0}
\definecolor{BlueViolet}    {cmyk}{0.86,0.91,0,0.04}
\definecolor{Periwinkle}    {cmyk}{0.57,0.55,0,0}
\definecolor{CadetBlue}     {cmyk}{0.62,0.57,0.23,0}
\definecolor{CornflowerBlue}{cmyk}{0.65,0.13,0,0}
\definecolor{MidnightBlue}  {cmyk}{0.98,0.13,0,0.43}
\definecolor{NavyBlue}      {cmyk}{0.94,0.54,0,0}
\definecolor{RoyalBlue}     {cmyk}{1,0.50,0,0}

\definecolor{Blue}          {cmyk}{1,1,0,0}
\definecolor{Cerulean}      {cmyk}{0.94,0.11,0,0}
\definecolor{Cyan}          {cmyk}{1,0,0,0}
\definecolor{ProcessBlue}   {cmyk}{0.96,0,0,0}
\definecolor{SkyBlue}       {cmyk}{0.62,0,0.12,0}
\definecolor{Turquoise}     {cmyk}{0.85,0,0.20,0}
\definecolor{TealBlue}      {cmyk}{0.86,0,0.34,0.02}
\definecolor{Aquamarine}    {cmyk}{0.82,0,0.30,0}
\definecolor{BlueGreen}     {cmyk}{0.85,0,0.33,0}
\definecolor{Emerald}       {cmyk}{1,0,0.50,0}
\definecolor{JungleGreen}   {cmyk}{0.99,0,0.52,0}
\definecolor{SeaGreen}      {cmyk}{0.69,0,0.50,0}
\definecolor{Green}         {cmyk}{1,0,1,0}
\definecolor{ForestGreen}   {cmyk}{0.91,0,0.88,0.12}
\definecolor{PineGreen}     {cmyk}{0.92,0,0.59,0.25}
\definecolor{LimeGreen}     {cmyk}{0.50,0,1,0}
\definecolor{YellowGreen}   {cmyk}{0.44,0,0.74,0}
\definecolor{SpringGreen}   {cmyk}{0.26,0,0.76,0}
\definecolor{OliveGreen}    {cmyk}{0.64,0,0.95,0.40}
\definecolor{RawSienna}     {cmyk}{0,0.72,1,0.45}
\definecolor{Sepia}         {cmyk}{0,0.83,1,0.70}
\definecolor{Brown}         {cmyk}{0,0.81,1,0.60}
\definecolor{Tan}           {cmyk}{0.14,0.42,0.56,0}
\definecolor{Gray}          {cmyk}{0,0,0,0.50}
\definecolor{Black}         {cmyk}{0,0,0,1}
\definecolor{White}         {cmyk}{0,0,0,0}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\dj{d\kern-0.4em\\v{c}ar"16\kern-0.1em}
\def\Dj{\mbox{\raise0.3ex\hbox{-}\kern-0.4em D}}

\def\o{\omega}
\def\e{\varepsilon}
\def\F{{\cal F}}
\def\f{\frac}
\def\p{\partial}
\def\vf{\varphi}
\def\vfp{\varphi^\prime}
\def\l{\lambda}
\def\L{{\bf L}}
\def\a{\alpha}
\def\b{\beta}
\def\ol{\overline}
\def\R{{\Bbb R}}\def\G{{\Bbb G}}\def\D{{\Bbb D}}
\def\C{{\Bbb C}}
\def\nin{\noindent}
\def\DJ{{\rm DJ\ }}

\newcommand{\tg}{\mathop{\rm tg}\nolimits}
\newcommand{\ctg}{\mathop{\rm ctg}\nolimits}
\newcommand{\arctg}{\mathop{\rm arctg}\nolimits}
\newcommand{\arcctg}{\mathop{\rm arcctg}\nolimits}


\def\df{\displaystyle\frac}
\def\dsum{\displaystyle\sum}
\def\dint{\displaystyle\int}
\def\fstp{{\hskip-0.5em}{\bf .}{\hskip0.5em}}

%\renewcommand{\figurename}{Slika}%
\newtheorem{te}{Teorema}
\newtheorem{de}{Definicija}
\newtheorem{po}{Posledica}
\newtheorem{lema}{Lema}
\newtheorem{stav}{Stav}
\newtheorem{primer}{Primer}

\def\bt{\color{Maroon}\begin{te}}
\def\et{\end{te}}

\def\bd{\color{Blue}\begin{de}}
\def\ed{\end{de}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Č \v{C} %
% Đ \Dj{} %
% Š \v{S} %
% Ž \v{Z} %

% č \v{c} %
% ć \'{c} %
% đ \dj{} %
% š \v{s} %
% ž \v{z} %

With that packages i get blank on

   \begin{verbatim}
č,ć,ž,š,đ 
\end{verbatim}

When i add

\usepackage[T1]{fontenc}     % default is 'OT1'
%\usepackage[utf8]{inputenc} % needed if you have an older TeX distribution
\usepackage{lmodern}         % recommended
\setlength\parindent{0pt}    % just for this example

I get "ÄŊÄĞÅ”ÅąÄŚ" .

  • What happens when you write {\ttfamily č,ć,ž,š,đ}? You'll probably get the same blank space, correct? – Werner Nov 30 '18 at 22:37
  • 2
    Welcome to TeX.SX! Can you please complete the question with a short full document showing the issue? – egreg Nov 30 '18 at 22:38
  • 1
    with utf8 coding they should appear as ć č š ž đ (depends on used fonts) ... – Zarko Nov 30 '18 at 23:14
  • 1
    Please consider looking at this answer. – zyy Dec 1 '18 at 4:19
  • @Милош Вучковић Your file is not UTF-8 encoded. – egreg Dec 1 '18 at 21:07
4

I assume you're using pdfLaTEx to compile your document. If that's the case, then as long as your TeX distribution is up to date, all you need to do is (a) load the fontenc package with the option T1 (the default that needs to be overridden is OT1) and (b) load a font package such as lmodern that's optimized for accented glyphs. If you have an older TeX distribution (i.e., more than about 1 year old), you'll also need to (c) load the inputenc package with a suitable option; in all likelihood, the utf8 option will be fine.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}     % default is 'OT1'
%\usepackage[utf8]{inputenc} % needed if you have an older TeX distribution
\usepackage{lmodern}         % recommended
\setlength\parindent{0pt}    % just for this example

\begin{document}
č ć ž š đ

\textsf{č ć ž š đ}

\texttt{č ć ž š đ}

\begin{verbatim}
č,ć,ž,š,đ 
\end{verbatim}
\end{document}
  • Incidentally, if you use either XeLaTeX or LuaLaTeX to compile your document, all you need to do is load the fontspec package. (If you load fontspec, be sure not to load either fontenc or inputenc.) If the fontspec package is loaded, the default font family is "Latin Modern". – Mico Dec 1 '18 at 8:09
  • I use overleaf. This is what i get when i use that package "ÄŊÄĞÅ”ÅąÄŚ" , instead of "č ć ž š đ" – Милош Вучковић Dec 1 '18 at 15:23
  • Also in other text if i use standard package i cant write č ć ž š đ and will get in compile č ć ž š đ , but with my package atm which i use i must \v{c} , \'{c} , \v{z}. \v{s} ,\dj{} to get č ć ž š đ. – Милош Вучковић Dec 1 '18 at 15:24
  • \documentclass[12pt,leqno, style=sailor, display=slides, paper=smartboard, orient=landscape]{article} \usepackage{listings} \lstnewenvironment{code}{% \lstset{frame=single,escapeinside=`', backgroundcolor=\color{yellow!20}, basicstyle=\footnotesize \ttfamily} }{} \usepackage[OT1]{fontenc} \usepackage{lmodern} \usepackage{titlesec} \setcounter{secnumdepth}{4} \titleformat{\paragraph} {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{} \titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex} – Милош Вучковић Dec 1 '18 at 15:25
  • 1
    @МилошВучковић - Please edit your original posting. That'll make it much easier to see what's going on than trying to decipher stuff in a comment. – Mico Dec 1 '18 at 16:14

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.