Summary Environment
My supervisor favours writing a summary of each chapter and section, and even including all these in a sort of table of contents at the front. Dr Ian Peake recently published his thesis that way:"Enabling meta-level support for language design and implementation through modular parsers", Ian Peake, School of Information Technology and Electrical Engineering PhD thesis, 2002.
Ian found a way of doing this, using pieces of code he found on the internet, but he didn't really understand how it worked. With the help of Daniel Jarrott, I found out how it worked, and worked out a way to use it with Daniel's UQ thesis package.
This is roughly how it looks when editing in LyX:
Software engineering principles are applicable to metalanguagesSoftware engineering principles are applicable to metalanguage design, motivating usual metalanguage criteria including expressiveness and metalanguage coverage by parser generators.Software engineering principles, such as reflection, expressiveness, prototyping and reuse motivate generic meta-tool criteria such as language adequacy, simplicity and standardisation, and tool language coverage and |
The summary page prints a bit like this:
|
Download the Summary files
You can download the files here (5K). Simply untar the file (ungzip if needed), and follow the instructions in the README file. Note: you will first need to install Daniel Jarrott's UQ thesis package. The README file (from summary_env.tar) can be read here.There is a known problem with LyX for Windows version 1.3.7, where the first time I try to view output, I get 7 LaTeX errors. I just ignore these errors, and select "view postscript" again. From then on the errors don't reappear. I've updated to the latest MiKTex, and it didn't fix the problem.
As of version 1.4.0 of LyX, a problem that used to result in some warnings on the console, and hence easy to ignore, are now popup message boxes, which require a click or keypress to dismiss. As a result, I found it easier to abandon the master/chapter scheme, and use the summary/chapter for the "master" document, as well as all the child documents. It means that you have to format up the headings yourself, add some newpage commands, and the like. See section below for details.
Also as from LyX 1.4, it seems that the navigation menu does not find a table
of contents for a document unless the following is added to the custom
layout files (e.g. ~/.lyx/layouts/summarychapter.layout):
input numarticle.inc
UQ theses in Chapter Document Class
As noted above, later versions of LyX don't seem to like documents with a different document class for child documents. So I no longer use the master document classes ("UQ thesis (master)" or "UQ thesis (master with summary)"). Here follows some details on what I did, in the hope that it will be useful for others at UQ and perhaps even elsewhere.Document Settings
UQ theses require margins of at least 20mm on each side, and 30mm on the inside margins. I found that the actual margins given to LyX do not translate well to measured margins on paper, and furthermore the margins depend on the printer used. Allow for some variation on a print run; paper is not hanlded perfectly by printers, especially the cheaper onces. So experiment with these numbers. Also consider using a laser printer at home if you have one, and using a new "toner cartridge" (really the guts of the printer) for the examination and final prints. Laser printers can be found for under AU$150 these days, with about AU$100 for the cartridges. (Remember that cheap printers often come with "starter" cartridges which don't last as long as the replacements.) NOTE: if you use the thesis template below, there is no need to enter every one of the below. However, I do suggest that you use the below to make sure that you don't have any excess baggage. Top 33mm Bottom 23mm Inner 32mm Outer 22mm Font: 12 point, with paragraphs separated by vertical space (MedSkip). Line spacing OneHaf (one and a half). Layout: A4, Portrait, Two-sided, obviously. Latex preamble:
\usepackage{url}
\usepackage{latexsym} % For \sqsubset, etc
I like to use fancy headers, so I also have:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\thepage}}
\cfoot{}
I like to use copious margin notes in tiny font:
\let\oldmarginpar\marginpar
\renewcommand\marginpar[1]{\-\oldmarginpar[\raggedleft\scriptsize\sf #1]{\raggedright\scriptsize\sf #1}}
\setlength{\marginparwidth}{11.5mm}
This seems to quell some warnings:
% To silence some warnings
\newcounter{mychapter}
\newcounter{mysection}
\newcounter{mysubsection}
\newcounter{mysubsubsection}
Generic Master File
I've hacked my master.lyx into a sort of generic UQ thesis template here, or here if you want summaries as well.Make good use of this page: http://internal.itee.uq.edu.au/rhd/theses (for UQ students only).
Two possible sections you may need to add are the "Candidate's Statement of Contribution to Jointly-published Work" and the " Statement of Contributions by Others". Read the pages from the above link carefully, especially if you choose to insert a paper that is co-authored with someone else as a thesis chapter. Good luck!
LyX for Windows
There are two options for running LyX under Windows: the native port and a version that runs under Cygwin. For a long time, I found that the Cygwin version ran better in many ways. However, as of Lyx 1.4.3, the Windows port seems to work quite well, and I had no end getting the Cygwin version to work at all.I found that the MikTeX makeindex doesn't seem to respect the INDEXSTYLE environment variable. It also doesn't seem to take a full path to the defalt.ist file (argument of the -s switch). To use an index style file as documented elsewhere on this page, I had to put a command into the makeindex script to copy the default.ist file to the current directory (which when LyX is calling makeindex is a temporary directory that changes almost every run, so you can't just copy the file once).
URLs in the Bibliography
Almost anyone who has tried to put a long URL into a bibliography will have run into the problem that LaTex (and hence LyX) tries very hard to justify bibliography entries, and does not seem to understand how to break long URLs.The URL package
One solution is to use the url package; it seems to be sensible about breaking URLs. All you have to do is this:- Install the URL package (if needed)
- In your document's preamble (of the master, if using a master and chapter system), add a line with \usepackage {url}
- For each URL that could cause problems, use \url{full_url}
The Natbib package
From Jan Petranek:I found the package natbib supports both URLs and Notes - without the need of embedding URLs as notes. This allows for bibtex-entries such as:
@article{gpl,
author = { Free Software Foundation },
title= { GNU General Public License },
url = { http://www.gnu.org/licenses/gpl.html },
note = { Version 2 },
year = { 1991 }
}
The entry in the bibliography is displayed as follows:[3] Free Software Foundation. Gnu General Public License. 1991. URL:http://
www.gnu.org/licenses/gpl.html. Version 2.
(with the appropriate parts set in bold etc.)
To use these features, all you have (or at least I had ) to do is:
- Add the following user-specific commands to the preamble:
\usepackage {url}
%% numbered citations with natbib
%% this is where you can specifiy all natbib's options
\usepackage [numbers]{natbib}
- Select a bibtex-style within lyx, in my case "plainnat"
Select the tab Layout->Document->Extra (or Layout->Document->Bibliography)
and choose
Use Natbib [x]
now select the Citation style, either as Author-year or as Numerical
(the naming of the menu may vary according to your Desktop Environment).
Read the documentation if you want to use author-year as the citation style.
Manual Breaks
Here is another alternative. I use a bibliography file (a file with a .bib extension). After using one for a while, most authors appreciate the benefits of using one. In the .bib file, you can force a new line with a double slosh, e.g. note = "\\http://www.program-transformation.org",Unless the URL is longer than one line, this works effectively. If it does happen to exceed one line, you can break it up yourself, e.g.
note =
"\\http://www.program-transformation.org/twiki/bin/view/Transform/
\\HistoryOfDecompilation1",
A disadvantage of this approach is that if you change your page
margins,
some URLs will break inappropriately again.Escapes
While on the subject of escapes, certain characters have to be quoted in bibliographic entries. The most difficult is the tilde character, which I find I can express with \verb!~! . (Note: if you use the url package, you don't need to worry about this in URLs, just in author names, etc.) You can use normal LaTeX special characters, e.g. author = "J. Tr{\"{o}}ger" . Underscores require escaping, i.e. replace _ by \_ in printable fields. The same goes for the & character. You probably know about forcing capitalisation with curly brackets, e.g. title = "{ClassCracker 3 Java} decompiler" .Company Web Pages
When citing a company web page with the alpha style, I usually put the company name in the organization field of an @MANUAL entry, e.g.@MANUAL{SMLtd,
key = "SML",
organization = "Software Migrations, Ltd",
title = "The Assembler Comprehension and Migration Specialists",
note = "Retrieved Feb 2003 from \url{
http://www.smltd.com}",
url = "http://www.smltd.com",
year = 2001
}
If using an @MISC entry without double curly braces, it treats the
company name (in the organization field) as a first, middle, and
last name, so the citation is [Ltd01]. With double curly braces around
the organisation, it uses
[Sof01], which is not too bad. (The double curly braces tell BibTeX not
to change the name to "Ltd, Software Migrations" as well.) With the key
field, it uses [SML01], as desired. Note that only the first 3 or (at most)
4 letters of the key field are used. The presence of an
author field will override any key field.
Key fields are often needed in MISC entries for web pages.Double Capital Surnames
When an author has a surname with two capitals, you can use the "lastname, firstname" format:author = "C. Cifuentes and Van Emmerik, M.",
or just use curly braces:
author = "C. Cifuentes and M. {Van Emmerik} or author = "C. Cifuentes and {Van Emmerik}, M.
Note that the first methods without the braces gives the double surname two letters in the citation key, e.g. [CVE02] verses [CV02]. Even with the braces, double surnames seem to count as two names, so a paper with five names, one of which has a double surname at the front, always seems to end up with three names and a +, regardless of whether that comes to 3 or 4 letters.
Adding an Index
One of my pet peeves when reading any document is the lack of a comprehensive index. LyX makes it easy to add an index, although as it comes there are some limitations. Firstly, there seems to be an incompatibility with the FloatFlt package. This package seems very immature to me, especially when used in LyX, so I would recommend not using it. That does mean that you are stuck with wide figures (unless you use two or more columns).Next, it's only hinted at in the LyX Extended Features manual that you can do fancy things with index entries. Some that I find useful are
- The ! character, e.g. Java decompilers!Dava . If you then add another index entry with say Java decompilers!JODE , you get a subitem, e.g.
Dava 16
JODE 17
- The @ character, which separates the "for ordering" and "for display" aspects of an index entry. Example:
would be included with other entries starting with the letter p, (as if the entry was "push instruction"), but the word push appears in typewriter font.
Similarly,
phi functions@$\phi$ functions
sorts as "phi" but prints as the greek letter.
- The vertical bar to put one entry in bold, e.g. loops|textbf
- Create a script called makeindex, and place it in the path before the system makeindex. I place ~/bin first in my path for this sort of thing. Obviously, makeindex needs to have the executable bit set (chmod +x makeindex).
- Its contents should be as per this example file. Obviously, customise aspects such as your system's path to the real makeindex. See also notes elsewhere on this page when you are using the MiKTeX version of makeindex.
- Create a file called default.ist . A good place for this would be in ~/indexstyles . Your makeindex script should point to this file.
- Its contents should be
delim_0 " "delim_1 " "delim_2 " "
When debugging the index, remember that LyX does not redo the index if it doesn't appear to need to. So enter a new index to force a call to makeindex.
Customising the toolbar
It's pretty easy to customise the toolbar. For example, I never use the "noun" button (which changes to an all upper case font), but often use typewriter font. To do this, copy the system default.ui (e.g. /usr/share/lyx/ui/default.ui) to ~/.lyx/default.ui and edit this file. Scroll down past all the menus (which are obviously also customisable) to the toolbar section. Comment out with the # character. To find the magic name for the new icon, you need the LyX command name. You can use the command bar (by default, just above the status bar, though on older versions, the status bar is the command bar) and guess from the other font changing commands. For example, since the other font commands start with font-, type font- and the right arrow key (for command completion). Up pops a window with all the font commands. You can experiment with them by selecting some text and typing the various commands. I found that font-code did just what I wanted. So just add a line withIcon font-code
in the appropriate place (buttons appear in the same order as in the default.ui file).
You will probably need an image file for the button. Since the command name is font-code, LyX will look for font-code.xpm. One place it will look is in your ~/.lyx/images directory. You can create one (I think 20x20 pixels is right) in the Gimp or other suitable paint program.
Figures
I found I could sometimes get figures to end up at the bottom of pages if I set the "ignore LaTeX rules" option (in the Float Settings). (Otherwise, regardless of hints to put graphics at the bottom of a page, they almost never seem to end up there, usually on the next page, or the page after that.) (With the "use default placement in later versions of LyX, this doesn't seem to work any more.)
Also, I find that it is possible to add text beside tall graphics using minipages. The liberal use of horizontal spaces (Insert Special character HFill), and vertical spaces (Insert Special formatting Vertical space) can make this look acceptable. Remember that the whole figure may move, including the text, so make sure that the text belongs with the graphic, not with the flow of the rest of the text.
I have not tried the Insert Float Text wrap float command of LyX 1.4, but the "floaflt" system of earlier versions was not satisfactory for me. I asume that the same LaTeX functionality is used, and that the problem is with LaTeX, not LyX.
Note that you can tick multiple boxes in the Float Settings (especially bottom of page). I have found a slight improvement in the frequency of figures ending up on the bottom of pages with LyX 1.4.
If, as I did, you have many software snippets as figures, you may end up with figures that are difficult to distinguish from the text at times. It becomes confusing to the reader to figure out where the text continues when interrupted by one or several such figures. I ended up with an examiner comment, requiring changes to make it more readable.
I found the best way to solve the problem was to surround affected figures with a box. This box includes the text or graphic, but also the caption text. (As of 1.4 there is a bug whereby there is a blank "Figure:" after the box, but this can be deleted with a backspace key.
Where possible, I make the box 90% of the column width. This makes the caption different enough from the surrounding text to make the whole figure stand out. The boxes and graphics inside become 90% smaller as a result, so adjust them (e.g. 50% -> 55%). Of course, some figures need the whole column width. For these, I used 95 or 98% width and I turned on the "retangular box" option to make them stand out more. Avoid use of 100% width if at all possible, as the figure ends up extending slightly beyond the margins.
The box ends up taking a little more space, so your layouts will change. The extra space also helps to separate the figures from the main text. It is probably a good idea to do all this before submitting for examination.
I found I could not do the same thing for tables. The only answer there seems to be to keep the caption short, so that it takes up less than 90% of the text width.
Changes not updating
As of LyX 1.4, there is a frustrating bug whereby changes made in a child document are not reflected in the output when you press control-shift-T (or similar). One workaround is to exit LyX and restart it and the postscript or other viewer, but that takes a lot of time.
I found the best way to work around this is as follows. Before starting Lux, open a\
Cygwin or command prompt window, and change to your Temp directory (e.g.
/c/Documents\ and\ settings/username/Temp . Remove all directories
starting with lyx_tmpdir, e.g. rm -rd lyx_tmpdir* . Start LyX, and after
generating your output, change to the only lyx_tmpdir... directory, and change to the
first buffer inside that directory (usually lyx_tmpbuf0). Leave this window handy.
After every change, remove *.dep (dependency file, automatically generated)
before attempting to regenerate the output. For the curious, this has something
to do with long file paths causing line wraps, and this causes some grep commands to
fail to find all the dependent files; that's one of the reasons it affects theses
more than general documents. There is a Bugzilla bug addressing this issue, which
should be fixed in LyX 1.5, released in early August 2007.
Last modified 3/Sep/07: Tables; Changes not updating; Boxes around figures; Non summary version
