I want to switch to lyx, but I'm having a hard time trying to use environments. I red that they are supposed to be as a class in the drop down list at the top left (If I'm nor wrong, together with section, subsection, etc). But I don't see theorem or anything like that. I guess I can just use a piece of tex code, but I would like to use it properly.
Am I doing something wrong or is there any problem with lyx?
I'm using the 2.0.5.1 version for mac.
[Tex/LaTex] Can’t use theorems in lyx (mac)
environmentslyxtheorems
Related Solutions
Add to the document preamble (Document --> Settings --> LaTeX preamble)
\newref{claim}{name=claim~}
and it will probably work. As mentioned by egreg in the comments, the refstyle
package is used, and you have to tell it what it should insert for labels starting with claim:
.
refstyle
also provides commands for start-of-sentence references (capital letter) and plural forms, and the words to insert in these cases can also be specified, e.g.
\newref{claim}{name=claim~,Name=Claim~,names=claims~,Names=Claims~}
I don't know, however, how to make LyX use these, other than through using an ERT, with e.g. \Claimref{claim:1}
. See the refstyle
documentation for details.
Example
Copy the following code to an empty file and save as a .lyx
file, e.g. example.lyx
. Open in LyX and compile. Screenshots of LyX view and PDF below.
#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\begin_preamble
\newref{claim}{name=claim~}
\end_preamble
\use_default_options true
\begin_modules
theorems-bytype
theorems-sec-bytype
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\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
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index 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 Section
Something
\end_layout
\begin_layout Claim
\begin_inset CommandInset label
LatexCommand label
name "claim:claim1"
\end_inset
I hereby claim that I don't use LyX.
\end_layout
\begin_layout Theorem
\begin_inset CommandInset label
LatexCommand label
name "thm:1"
\end_inset
LyX makes some things harder.
\end_layout
\begin_layout Standard
Inserting references:
\begin_inset CommandInset ref
LatexCommand formatted
reference "thm:1"
\end_inset
and
\begin_inset CommandInset ref
LatexCommand formatted
reference "claim:claim1"
\end_inset
.
\end_layout
\end_body
\end_document
Elaborating my comment to an answer...
Question 1: "Enumerate" uses small portion of the page.
Answer: If you use enumerations in LyX / LaTeX, I guess, it does not matter whether you use a right-to-left or a left-to-right language, the indentation will always be the same amount (of course, on the right side if using right-to-left). LaTeX (which is generated by LyX) uses typesetting rules that are quite professional. You will also see that an average line (at least in English) has about 65 characters and thus, a quite big margin might be left. This limit on the length of a line is used for better readability. Here is an example.
The example was simply created by using a new LyX document with
\usepackage[english]{babel}
\usepackage{blindtext}
put into "Document > Settings... > LaTeX Preamble" and
\blindtext \blindlistlist[2]{enumerate}[2] \blindtext
put as TeX code/ERT (<Crtl>-L
) in the main document. (Note that the LaTeX package blindtext
is used.)
Question 1a: How to replace this numbering with Hebrew letters.
Answer: As a quick workaround you can use the description environment instead. Then you should be able to put any label you want. (Furthermore, nesting of enumerations, itemizations, descriptions is possible in LyX.)
Otherwise see Robust method to apply Hebrew numeral in an enumeration list? (Possibly you need ask a separate question how to integrate that in LyX...)
Question 2: Long equations are divided incorrectly...
Answer: LaTeX break equations not at arbitrary points but usually after relation symbols. If you do not like the break up then - as a workaround - you can split the inline math environment into two or more.
You might also search on this site for questions tagged with math-mode and line-breaking.
Question 3: The equation is cut in "Display Mode".
Answer: A common way to deal with long formulas and many equations is to use "Insert > Math > AMS align Environment". Then you can add rows and break up the equations over several lines. It looks like in the following picture.
Best Answer
First you have to add a module. Go to Document > settings > Modules and choose one of the (several) theorem modules. See here:
Then you can access them from the environment menu: Note that a useful shortcut is to do "alt+p, space" and then start typing, e.g. "theorem". Press return.