2

I'm writing lecture notes in Hebrew using lyx. I use the framed package to have my theorems inside a nice gray box. It all seemed to work fine, until I noticed a strange behavior when I try to put a description list inside.

Here's how it looks like: enter image description here

I tried to create a MWE in English for you, but there was no such problem, so apparantly it has something to do with Hebrew. Here's how it looks, in comparison: enter image description here

Both use the exact same code in the document preamble:

\usepackage{xcolor}
\usepackage{framed}
\usepackage{amsthm}
\definecolor{shadecolor}{rgb}{.8, .8, .8}
\newenvironment{myframe}{
\def\FrameCommand{\colorbox{shadecolor}}%
\MakeFramed {\advance\hsize-\width }}
{\endMakeFramed}

\newtheorem{newThm}[thm]{\bfseries Theorem} \renewenvironment{thm} {\begin{myframe}\begin{newThm}\begin{normalfont}} {\end{normalfont}\end{newThm}\end{myframe}}

So I don't know how to locate the problem. If anyone has any ideas I'd be happy to hear. Also, sorry if this the question is not written properly, I'm new here... Thanks!

Edit: Here's a full Latex code of my MWE, generated by Lyx. I'm sorry that it turned out quite long, it's the best I could do!

\documentclass[a4paper,english,hebrew]{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{David}
\setsansfont[Mapping=tex-text]{Arial}
\setmonofont{Miriam Fixed}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}

\makeatletter

% LyX specific LaTeX commands. \pdfpageheight\paperheight \pdfpagewidth\paperwidth

% Textclass specific LaTeX commands. \theoremstyle{plain} \newtheorem{thm}{\protect\theoremname} @ifundefined{date}{}{\date{}}

% This is the preamble! \usepackage{xcolor} \usepackage{framed} \usepackage{amsthm} \definecolor{shadecolor}{rgb}{.8, .8, .8} \newenvironment{myframe}{ \def\FrameCommand{\colorbox{shadecolor}}% \MakeFramed {\advance\hsize-\width }} {\endMakeFramed}

\newtheorem{newThm}[thm]{\bfseries Theorem} \renewenvironment{thm} {\begin{myframe}\begin{newThm}\begin{normalfont}} {\end{normalfont}\end{newThm}\end{myframe}} %This is the end of the preamble!

\AtBeginDocument{ \def\labelitemi{\normalsize(\bullet)} }

\makeatother

\usepackage{polyglossia} \setdefaultlanguage{hebrew} \setotherlanguage{english} \addto\captionsenglish{\renewcommand{\theoremname}{Theorem}} \addto\captionshebrew{\renewcommand{\theoremname}{משפט}} \providecommand{\theoremname}{משפט}

\begin{document} \begin{thm} לורם איפסום: \begin{enumerate} \item דולור סיט אמט. \item דולור סיט אמט. \end{enumerate} \end{thm}

\begin{thm} לורם איפסום: \begin{description} \item [{דולור.}] סיט אמט. \item [{דולור.}] סיט אמט. \end{description} \end{thm}

\end{document}

35T41
  • 327

1 Answers1

2

The bad news is that I can’t reproduce your bug. The good news is, I didn’t reproduce your bug. Without a MWE, I can’t tell you why you’re getting that error, but here’s a MWE that works (in TeX Live 2020 with LuaLaTeX).

\documentclass[a4paper]{article}
\tracinglostchars=2
\usepackage{amsmath, amsthm}
\usepackage[bidi=basic, layout=sectioning.tabular, nil]{babel}
\usepackage{xcolor} % For \colorbox
\usepackage{framed} % For \MakeFramed
\usepackage{unicode-math}
\usepackage[english,hebrew]{translator} % For \providetranslation, \trnaslate

\defaultfontfeatures{ Scale=MatchUppercase, Ligatures=TeX, Renderer=HarfBuzz }

% The Culmus fonts are free for download at % https://sourceforge.net/projects/culmus/ \defaultfontfeatures[DavidCLM]{ UprightFont = -Medium, ItalicFont = -MediumItalic, BoldFont = -Bold, BoldItalicFont = -BoldItalic, Extension = .otf }

\defaultfontfeatures[MiriamCLM]{ UprightFont = -Book, BoldFont = -Bold, Extension = .ttf }

\babelprovide[import]{english} \babelfont{rm} [Scale=1.0, Language=Default]{NewComputerModernBook} \babelfont{sf} [Language=Default]{NewComputerModernSansBook} \babelfont{tt} [Language=Default]{NewComputerModernMonoBook}

\babelprovide[import, main]{hebrew} \babelfont[hebrew]{rm} [Language=Default]{DavidCLM} \babelfont[hebrew]{sf} [Language=Default]{MiriamCLM} \babelfont[hebrew]{tt} [Language=Default]{MiriamMonoCLM}

\setmathfont{NewCMMath-Book} \setmathrm{NewComputerModernBook} \setmathsf{NewComputerModernSansBook} \setmathtt{NewComputerModernMonoBook}

\providetranslation[to=Hebrew]{Theorem}{משפט}

\definecolor{shadecolor}{rgb}{.8, .8, .8} \newenvironment{myframe}{ \def\FrameCommand{\colorbox{shadecolor}}% \MakeFramed {\advance\hsize-\width }} {\endMakeFramed}

\newcounter{thm} \newtheorem{newThm}[thm]{\bfseries \translate{Theorem}} \newenvironment{thm} {\begin{myframe}\begin{newThm}\begin{normalfont}} {\end{normalfont}\end{newThm}\end{myframe}}

\begin{document} \begin{thm}{לורם איפסום} \begin{description} \item[לורם] איפסום

\item[דולור] טיט אמט \end{description} \end{thm}

\begin{otherlanguage}{english} \begin{thm}{Lorem Ipsum} \begin{description} \item[Lorem] Ipsum

\item[Dolor] Sit amet \end{description} \end{thm} \end{otherlanguage}

\end{document}

David CLM / New Computer Modern sample

Davislor
  • 44,045
  • Thanks for your answer, unfortunately when I tried copying the relevant part to my preamble it just gave me a bunch of errors which I could not fix. Maybe it has something to do with you using LuaLaTeX while I use Xetex. – 35T41 Dec 21 '20 at 06:35
  • I figured out how to let Lyx export a latex file for me (in Xetex). It is quite long and probably not a minimal Latex code, but it is what I could do... I'll copy the code to my edited question. Again, sorry that I'm now savvy enough to give you the ideal setup for helping me. – 35T41 Dec 21 '20 at 06:38
  • @35T41 Yes, that would be the reason. I can post a version that works in XeTeX, but it won’t have every feature LuaTeX supports. – Davislor Dec 21 '20 at 06:46
  • I edited my question, now it contains a complete latex code. I guess this is a downside of working with Lyx instead of directly with Latex. Thanks again for your help. – 35T41 Dec 21 '20 at 06:49
  • @35T41 Okay. framed seems to have this bug when compiling with XeLaTeX, but not LuaLaTeX. – Davislor Dec 21 '20 at 06:59
  • Strange. Can anything be done to overcome this issue? Maybe some ad-hoc trick? – 35T41 Dec 21 '20 at 07:05
  • Well, adding \normalcolor along with \bfseries in the theorem formatting and layout=sectioning.tabular.lists to the Babel options seems to mitigate, but not eliminate, the problem in XeTeX. If you can’t switch to LuaLaTeX, maybe you can replace the description lists. – Davislor Dec 21 '20 at 07:48
  • OK, I'll try that. Thanks again! – 35T41 Dec 21 '20 at 08:55
  • @35T41 Also, there seems to be a bug with fontspec not being able to find NewComputerModernBook.fontspec, etc., in XeTeX, so my example font command won’t work, and you’d need to load NewCM10-Book, NewCMSans10-Book, etc. This is incidental to the main issue. – Davislor Dec 21 '20 at 09:10