2

I trying to insert a theorem to tcolorbox without title.

Here is MWE (with LyX):

% Preview source code

%% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setlength{\parindent}{0bp}
\usepackage{color}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
 {hyperref}
\hypersetup{
 linkcolor=blue}

\makeatletter

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


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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair}

\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\addtokomafont{disposition}{\rmfamily}

\usepackage{tcolorbox}

\makeatother

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

\begin{document}
%\tcbox{ <=============================
\begin{thm}
as
\end{thm}

%} <=============================
\end{document}

Now, if you remove the lines with the <============================= it wont compile, do you know why and how can I fix it?

(I tried to remove some code lines but then it always give me errors)

Thank you!

::Edit:: Here is other MWE:

\documentclass{scrartcl}

\usepackage{tcolorbox}
\newtheorem{theorem}{Theorem}

\begin{document}

%\tcbox{ <=============================
\begin{theorem}
Let $f$ be 
\end{theorem}
%} <=============================
\end{document}
6
  • 1
    I get a lot of erros when compiling your code. as you posted it here, does it compile without errors on your computer? If yes, then please ignore my comment. If no, then I think the origin of your problem is not what you suspect. You should probably go through your code line-by-line and get rid of all useless parts that could cause erros (e.g. I don't see why you have \makeatletter there). Also it's hard for others to try and help you because to compile your code they have to install all those fonts etc, eventhough this seems not essential for your question.
    – sheß
    Commented Apr 1, 2019 at 12:10
  • At my computer it compiles... @sheß
    – heblyx
    Commented Apr 1, 2019 at 12:47
  • Yes... Maybe it's something at LyX?
    – heblyx
    Commented Apr 1, 2019 at 12:51
  • Could also be problem on my side. Either way, your MWE loads a lot of things (fonts, etc) that are seem not essential to reproduce your problem but make it impossible for some (me) to try and help you with your problem. You might increase your chances to get feedback by minimizing your MWE further.
    – sheß
    Commented Apr 1, 2019 at 12:53
  • 1
    I'm putting another MWE....
    – heblyx
    Commented Apr 1, 2019 at 12:56

1 Answer 1

2

When I use \begin{tcolorbox}...\end{tcolorbox} it works for me.

\documentclass{scrartcl}
\usepackage{tcolorbox}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{tcolorbox} %<=============================
\begin{theorem}
Let $f$ be 
\end{theorem}
\end{tcolorbox} %<=============================
\end{document}

enter image description here

Based on the manual it seems unlikely that this approach would constrain you compared to \tcbox: enter image description here

Let me know if there's a reason that does not work for you

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .