Graphics, Figures & TablesCan't use graphics packages with [hebrew]{babel}

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
YS9901
Posts: 4
Joined: Tue Mar 03, 2015 4:22 pm

Can't use graphics packages with [hebrew]{babel}

Post by YS9901 »

Hi, I'm trying to add some figures to my text which is written in Hebrew. When I'm using one of the graphics packages, like [tikz] and [graphicx], to add figures, all the figures appear on the text just fine. But adding the [hebrew]{babel} package replaces all of the figures in the text with blank white space. Does anyone know how to fix this? Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Can't use graphics packages with [hebrew]{babel}

Post by Johannes_B »

Hi, can you add a minimal but compilable example for us to reproduce the issue? This might be something very trivial in your code.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
YS9901
Posts: 4
Joined: Tue Mar 03, 2015 4:22 pm

Can't use graphics packages with [hebrew]{babel}

Post by YS9901 »

Ok, with this code I get a square

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\end{tikzpicture}

\end{document}
With this code I get a blank page

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[hebrew]{babel}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\end{tikzpicture}

\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Can't use graphics packages with [hebrew]{babel}

Post by Johannes_B »

This is a known problem. I found an answer by Stefan and it seems, you simply need to locally switch the language to english.

Code: Select all

\documentclass[english,fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9,utf8x]{inputenc}
\usepackage{tikz}
\usepackage[english,hebrew]{babel}
\begin{document}
טקסט לפני תמונה

\begin{otherlanguage}{english}
\begin{tikzpicture}[scale=1]
\draw (0,0) -- (1,1);
\end{tikzpicture}
\end{otherlanguage}

טקסט אחרי תמונה
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Can't use graphics packages with [hebrew]{babel}

Post by Stefan Kottwitz »

So your test document would be, adding english support for TikZ pictures:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[english,hebrew]{babel}
\usepackage{tikz}
\begin{document}
\begin{otherlanguage}{english}
  \begin{tikzpicture}
    \draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
  \end{tikzpicture}
\end{otherlanguage}
\end{document}
Stefan
LaTeX.org admin
Post Reply