4

I'm autogenerating pdfs via pdflatex and perl and I am having problems in getting these characters to print in pdflatex: Љ Б Д И П و △ ★ ✚ ✠ ✤ ✶ ✸ ❀ ❃

Here is a template of the statments I use with for instance ❃ inserted:

\documentclass[10pt]{scrartcl}
\usepackage[german,english,greek]{babel}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{graphicx}
\usepackage[utf8x]{inputenc}
\usepackage[
pdftex,
bookmarks=true,
bookmarksopen=true,
bookmarksnumbered=true,
pdfstartpage=1
]
{hyperref}
\usepackage{footnote}
\usepackage{rotating}
\usepackage{tablefootnote}
\usepackage{nonfloat}
\usepackage{ctable}
\usepackage{lipsum}
\usepackage{bibentry}
\usepackage{color}
\usepackage{array}
\usepackage[margin=3cm]{geometry}


\title{\bfseries Test}
\date{}
\begin{document}

\section*{1}

❃ 

\end{document}

I have installed the language packs on Ubuntu via

sudo apt-get install texlive-lang-european texlive-lang-cyrillic texlive-lang-german texlive-lang-greek 

I think Љ Б Д И П are cyrillic but if I use

\usepackage[german,english,greek,russian]{babel}

Then the greek Α Γ Δ Ε Η Ι Λ Μ Ν Ο Ρ Σ Τ Υ Χ Ω (that are also included in my character set) will fail while Љ Б Д И П will succeed. So it seems that "greek and russia" are incompatible ? Is there a easy way out of this? Is it possible to get "Љ Б Д И П و △ ★ ✚ ✠ ✤ ✶ ✸ ❀ ❃" encoded by some means without adding "russia" to babel? And where are the other symbols defined? ❀ for instance is U+2740. I think I have to use:

\DeclareUnicodeCharacter{2740}{ ... }

However then I have to know the latex version of ❀.

  • 1
    What's the default language of your document? – egreg Jan 07 '17 at 20:27
  • The default language is german – Konrad Eisele Jan 07 '17 at 20:30
  • 2
    Are you able to use LuaTeX or XeTeX? With LuaTeX, you would use the fontspec package instead of fontenc, polyglossia instead of babel, and always utf-8 encoding. Then you could simply paste the characters from a character map, as long as you have them in a font. Or you could call them by Unicode. It does not matter which language(s) you specify, since this method is inherently multi-lingual. Dingbats OK too. –  Jan 07 '17 at 22:54
  • 2
    Do you need all those packages to reproduce not printing something? Please make your code minimal. Also, you probably want to include all the characters you need so that people have a proper test case to work with. – cfr Jan 08 '17 at 00:25
  • Off-topic: hyperref should be loaded *late*. – cfr Jan 08 '17 at 00:25
  • RobtA: I rather not switch to something other than pdflatex, I use javascript embedded in pdf and I guess I would have to start from scratch. In the worst case I will generate jpgs for those chars I cannot get right. Cfr: i have a excel sheet with text containing the extra chars, I scan it with perl and generate pdfs for each row. You are right that not all packages are needed. – Konrad Eisele Jan 08 '17 at 12:44

2 Answers2

3

Here is what I had to do:

  • Packages

Code:

\documentclass[a4paper,12pt,landscape,enabledeprecatedfontcommands]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage[T1,T2A]{fontenc}     
\usepackage[russian,arabic,farsi,greek,german]{babel}
\usepackage{arabtex}

Code:

\usepackage{pifont}
\DeclareUnicodeCharacter{10048}{ \ding{95} }
\DeclareUnicodeCharacter{10051}{ \ding{93} }
...
  • For the cyrillic characters Љ Б Д И П and greek character Α..Ω :

Code:

\textcyrillic{П}
\textgreek{Ω}

Code:

   \RL{w}

Conculsion:

  1. german, english are handled by babel
  2. cyrillic symbols are handled by \textcyrillic{}
  3. greek symbols are handled by \textgreek{}
  4. arabic symbols are handled by \RL{}
  5. wingding entries are handled by pifont, \ding and \DeclareUnicodeCharacter

Notes:

  1. Languages in the babel usepackage statement seem to override each other. Therefore \textcyrillic and \textgreek is used.
  2. I use utf8x for inputenc
  3. When using arabtex I also have to add enabledeprecatedfontcommands
1

The simplest way is use xelatex\lualatex with a font with all the glyphs that you need:


mwe


\documentclass{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}

\begin{document}

Adding special characters Љ Б Д И П و △ ★ ✚ ✠ ✤ ✶ ✸ ❀ ❃ in \LaTeX

\end{document}

Unfortunately, this is not the case of most fonts, so, depending on the font style and symbols what you need, it could be a good idea just change the main font, as in the example, or change the font only in macros to type selected symbols with a different font, or obtain these symbols of packages as bbding and amssymb (that provide commands for at least some stars and crosses of the example), o even use macros were the symbol is supplied simply by a small image (~ 1em or so ...). If the image is a vectorial draw (svg) exported to pdf, the result is perfect.

Fran
  • 80,769