# Good format for homeworks in LyX

I am using LyX to type in my homework solutions, but I don't like my format.

The homework itself is in the format of questions 1,2,... and each question has sub-questions: 1.1,1.2,... etc

In the current way I dislike two things:

1. There is no space between question (this makes it hard to search for a solution for some question).
2. I am using ctrl+b to make the numbering (of the question I am answering) easily seen, but it doesn't help too much

Is there a better way to type in homework in Lyx ? Maybe some kind of pre-defined format ?

ADDED: This is an example of one of my solutions: https://www.dropbox.com/s/1f1v5x0wthjh2k4/HW2.pdf

-
Have you looked at the exercise package? –  GTK Dec 5 '12 at 5:00
@GTK - I am unaware of it, how can I use it ? –  Belgi Dec 5 '12 at 5:03
Are you creating homework assignment and solutions for students, or answering homework as a student? In either case, it would help to provide a minimal example of your LaTeX source. Hard to say what to do without knowing what you are doing. –  GTK Dec 5 '12 at 5:52
What do you mean with HW? –  Martin Schröder Dec 5 '12 at 7:26
You could mark the questions as sections, and parts as subsections. If hand numbering, then you could use \section*{Question 1} etc. If you want to do this automatically and/or make the headings a bit more sober, then you could use the titlesec package. –  Andrew Swann Dec 5 '12 at 12:07

You may go along with the previous answer of using sections and paragraphs to separate your questions but then you still have the problem of formatting those (which can be done easily in the Document->Settings->LaTeX Preamble). However, I will assume you have a stock of work in the present format and you would like to make only minor changes to the document to facilitate your layout.

I would like say in advance that I recommend you read the LyX tutorial to learn how to use enumerated lists, when to hit return, and when to hit Ctrl-Return. You can turn your questions into enumerated lists by placing the cursor on a line and selecting enumerated list where is says standard on the top left. You will see that a number appears in front, so you may remove your hand-written question number.

Only then will this work. Then you have to mark everything that is answer to that question and hit Shift-Alt-(right cursor key) to make it part of the point in the list. If you hit Return, the format stays the same, so make sure that all of your answer is of format standard (not part of your enumerated list).

Only then will this formatting work.

Since I have no way to send you an edited version of your document, I have appended a minimal LyX file below.

Formatting bold numbers for your enumerated lists is easy, making them spaced is a little more tricky, here goes:

To add space, I follow a description originally intended to Squeeze Space in LaTeX that I have used previously.

Download the package atbeginend.sty and save it in the same directory where your HW2.lyx file resides.

You can then effect the changes you desire by going to
Document->Settings->LaTeX Preamble
and pasting the following block of LaTeX code:

%% format enumerated list:
\renewcommand{\labelenumi}{\LARGE \textbf{\arabic{enumi}}}
\renewcommand{\labelenumii}{\normalsize \textbf{\arabic{enumi}.\arabic{enumii}}}
\renewcommand{\labelenumiii}{\normalsize \textbf{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}}}
%% the following according to http://www.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html
%% add some space:
\usepackage{atbeginend}
\AfterBegin{enumerate}{%
}
\AfterBegin{itemize}{%
}


You can change the \LARGE and \normalsize statements to change the size of the numbers. Change the number 3.0 if you want to change the space between questions (in units of line spacings). I have added an analogous statement for itemized lists with no change (factor of 0.0 as a placeholder in case you would like to manipulate those, too.

From my output for your file (edited to use enumerated lists):

The web page Squeeze Space in LaTeX contains further useful ways to manipulate space that you may wish to add to your LaTeX preamble.

My Minimal Working Example (MWE) output:

MWE code follows. Paste this into a text editor and save-as MWE.lyx
Do NOT paste this into LyX, this is LyX code, not content.
You can then load the file from LyX and it should appear as a short document with enumerated lists.

#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\textclass article
\begin_preamble
%% format enumerated list:
\renewcommand{\labelenumi}{\LARGE \textbf{\arabic{enumi}.}}
\renewcommand{\labelenumii}{\normalsize \textbf{\arabic{enumi}.\arabic{enumii}.}}
\renewcommand{\labelenumiii}{\normalsize \textbf{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}}
%% the following according to http://www.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html
%% add some space:
\usepackage{atbeginend}
\AfterBegin{itemize}{%
}
\AfterBegin{enumerate}{%
}
\end_preamble
\use_default_options true
\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

\begin_body

\begin_layout Title
My howework
\end_layout

\begin_layout Standard
Check out my answer:
\end_layout

\begin_layout Enumerate
Some big bold numbers, yo.
\end_layout

\begin_deeper
\begin_layout Enumerate
With subdivisions.
\end_layout

\begin_layout Standard
\end_layout

\end_deeper
\begin_layout Enumerate
Check out the space above this!
\end_layout

\end_body
\end_document

-
You may add white space by hand any time via Insert->Formatting->Vertical Space... and selecting Custom and entering, for example 2ex to add space worth two units of the width of the letter "x" in your font. –  Andreas Dec 12 '12 at 3:40
For what Shift-Alt-(right key) does, look into Help->LyX UserGuide and read section 3.4 Nesting Environments. Note the vertical red bars on the left edge of the document in LyX in the MWE, indicating the depth. Change the depth to make text part of a preceding list item, or list sub-item. Note that what is displayed as "1. (a)" in LyX is typeset as "1.1." in the pdf due to the format that we have added in the Preamble, as described in my answer. –  Andreas Dec 12 '12 at 4:49

The output is ugly because the enumerate environment isn't suited to the task to which you put it, of dividing up the document - it is meant for a list of closely related items, not marking the natural break points of the manuscript.

Instead you should do as Andrew Swann suggested in a comment, and make each question into a separate section, using the section* head (see the drop-down menu that usually reads Standard when you are entering text), since automatic enumeration is a nuisance given the questions come with their own numbering. I would recommend using paragraph* head to introduce parts of questions, which should typeset as a single paragraph with the text that follows.

Consider adding the AMS Theorems module (accessed from Document > Settings..., under Modules), which allows you to add special structure for definitions: they are alternative heads for definitions, remarks, claims, and the like. The remark head is good, in particular, for the many observations you make to motivate the steps you make.

-