1

I'm writing a LyX document in Hebrew and I want to inset some inline code snippet but the code is reversed when rendered.

The minimal lyx example is here.

And it look like this:

resulting pdf

LyX source:

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass heb-article
\begin_preamble
\usepackage{fullpage}
\usepackage{adjustbox}
\usepackage{minted}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language hebrew
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index אינדקס
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard

\size largest
הרעיון הבסיסי של
\family roman
\series medium
\shape up
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none

\family default
\series default
\shape default
\emph default
\bar default
\strikeout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
LyX
\lang hebrew
 הוא שאין צורך לטפל בעיצוב.
 ישנה רשימה של עיצובים קיימים וניתן לבחור מתוכה את אופי הטקסט (כותרת ראשית,
 כותרת משנית, הערת שוליים וכו').
 כך, התוצאה הסופית אמורה להיות עקבית ובעלת מראה מקצועי.

\begin_inset Newline newline
\end_inset


\size default

\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{minted}{python}
\end_layout

\begin_layout Plain Layout

def boring(args = None): pass
\end_layout

\begin_layout Plain Layout


\backslash
end{minted} 
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\size largest
בנוסף, מאפשר 
\lang english
LyX
\lang hebrew
 כתיבה נוחה של משוואות מתמטיות ולכן נפוץ בקרב קהילת האקדמאים העוסקים במדעים
 מדויקים.
\end_layout

\end_body
\end_document

Exported TeX file:

%% LyX 2.1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9,cp1255]{inputenc}
\usepackage{float}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}
\newtheorem{theorem}{\R{משפט}}[section]
\AtBeginDocument{\make@lr\thetheorem}

% The following chunk fixes export with XeTeX.
% It is needed because polyglossia is used by default
% and \make@lr is only defined by babel.
\@ifundefined{make@lr}
{\def\make@lr#1{\begingroup
    \toks@=\expandafter{#1}%
    \edef\x{\endgroup
  \def\noexpand#1{\noexpand\@number{\the\toks@}}}%
  \x}}{\relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{fullpage}
\usepackage{adjustbox}
\usepackage{minted}

\makeatother

\usepackage{babel}
\begin{document}
{\LARGE{}הרעיון הבסיסי של }\inputencoding{latin9}\L{{\LARGE{}\LyX{}}}\inputencoding{cp1255}{\LARGE{}
הוא שאין צורך לטפל בעיצוב. ישנה רשימה של עיצובים קיימים וניתן לבחור
מתוכה את אופי הטקסט (כותרת ראשית, כותרת משנית, הערת שוליים וכו').
כך, התוצאה הסופית אמורה להיות עקבית ובעלת מראה מקצועי. }\\
\begin{minted}{python}
def boring(args = None): pass
\end{minted} 

{\LARGE{}בנוסף, מאפשר }\inputencoding{latin9}\L{{\LARGE{}\LyX{}}}\inputencoding{cp1255}{\LARGE{}
כתיבה נוחה של משוואות מתמטיות ולכן נפוץ בקרב קהילת האקדמאים העוסקים
במדעים מדויקים.}
\end{document}
  • 1
    Welcome. Please edit your question and include your example here so that it continues to help people after the pastebin evaporates. – cfr Jun 25 '15 at 18:46
  • @cfr OK pardon me, I though that because it's a minimal LyX example and consists of quite a lot source it'd be better to paste it somewhere else. – Darius Jun 25 '15 at 18:47
  • 1
    No need to apologise. You might want to read this. The answer there explains another option you have if you want to export a .tex file for your minimal example. As explained there, the big advantage is that more people will be able to answer. (For example, I can't answer your question as it stands or even reproduce the issue as I know nothing about LyX.) But there are people around here who will try to answer as they do know LyX - just it may take a little longer. – cfr Jun 25 '15 at 18:53
  • @cfr Thanks for the useful link, I've added the exported tex. – Darius Jun 25 '15 at 18:57
3

It works for me if I

  1. Make sure the ERT is on its own line (return before and after).
  2. Highlight the ERT and go to Edit > Language > English.

I get the following file:

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass heb-article
\begin_preamble
\usepackage{fullpage}
\usepackage{adjustbox}
\usepackage{minted}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language hebrew
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index אינדקס
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard

\size largest
הרעיון הבסיסי של
\lang english
LyX
\lang hebrew
 הוא שאין צורך לטפל בעיצוב.
 ישנה רשימה של עיצובים קיימים וניתן לבחור מתוכה את אופי הטקסט (כותרת ראשית,
 כותרת משנית, הערת שוליים וכו').
 כך, התוצאה הסופית אמורה להיות עקבית ובעלת מראה מקצועי.
\begin_inset Newline newline
\end_inset


\end_layout

\begin_layout Standard

\lang english
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{minted}{python}
\end_layout

\begin_layout Plain Layout

def boring(args = None): pass
\end_layout

\begin_layout Plain Layout


\backslash
end{minted} 
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\size largest
בנוסף, מאפשר 
\lang english
LyX
\lang hebrew
 כתיבה נוחה של משוואות מתמטיות ולכן נפוץ בקרב קהילת האקדמאים העוסקים במדעים
 מדויקים.
\end_layout

\end_body
\end_document

and the following output:

enter image description here

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.