LyX Tips for Thesis Writing

LyX is a lovely bit of software for preparing beautiful documents – you get the high quality output of LaTeX and the advantages of logical document description in a usable interface and without having to remember TeX syntax.  There are a few aspects of using LyX that puzzled me while writing a certain large document, however – many of these are dealt with in the LyX FAQ, but I thought it would be worth collecting those that were most useful to me here.

Use pdflatex for Output

There are various different options for generating output PDF output in LyX, but it will save you trouble if you do everything using pdflatex in the first place. (I think this is the upshot of the slightly unclear advice in the FAQ on the subject.) This turned out to be particularly important because when your document is 50000 words long and has over 100 figures, the other methods take over 10 minutes to generate a PDF; pdflatex would finish in a couple of seconds. If you take this advice then you have to change the Document -> Settings -> Document Class option to pdfTeX, or you get some surprising errors. Also, I would strongly recommend that you only use PNG files for bitmap images and PDF for vector graphics. (PNG is obviously sensible, but in the case of vector graphics I found PS and EPS files unexpectedly awkward in terms of getting the orientation and clipping right.)

Incorrect Colours in Bitmap Graphics

I came across a bizarre problem where the colours would be slightly wrong for certain PNG files that I include in the document. (I suppose I should say “colors” too, just for the sake of searchers using American English.) This turned out to be a problem with full-colour PNG images with transparency (i.e. RGBA images), which my notes say is discussed further in these posts. Setting the PDF version as suggested in the first of those posts didn’t help me at all, so I had to convert all my RGBA PNG files to RGB. If you want to check for these files you can use file(1), something like:

find . -type f -iname '*.png' -print0 | xargs -n 1 -0 file | egrep RGBA

… and I fixed them by feeding the filenames (one per line) to a script like:


set -e

while [ $# -ne 0 ]
 convert "$1" png24:"$t" && mv "$t" "$1"

Obviously you need imagemagick installed for the “convert” command.


By default there is no extra vertical space to separate footnotes, but I much prefer there to be a small gap. To do that, add to the following line to the document preamble:



By default, the formatting of caption text in floated figures looks very similar to the main body text. Somewhere on the web I found the recommendation to use the “caption” package to change this, e.g. by adding the following to the preamble:


Fitting Tables Onto Pages

Making tables fit on the page is annoying – just changing the text size often doesn’t reduce the overall size or causes a horrible font to be used. Resizing the whole table is the best way I found. Before the table (either in a float or in the normal flow of the document) I added the following in ERT:


and then immediately after the table added, again in ERT:


This scales the table such that the width of the table fits the page width.

Suppressing Pages Numbers For Full Page Figures

If you want to use a whole page for a floated figure, the page number can overlap with the figure or just look odd.  However, second tip here: works well to remove page numbers from all-page figures. To summarize, add the following to the preamble:

\floatpagestyle{plain} % Default page style for pages with only floats

Then, in ERT before the figure (but still in the float) add:


… and similarly, after the figure but above the caption add:


… or you may find the caption too close to the graphics.

Better On-Screen Fonts in PDFs

As explained in the second question in this mini-FAQ on generating PDFs from LyX you should use the outline font version of Computer Modern instead of the bitmapped versions. For me, this boiled down to going to Document -> Settings -> Fonts and setting the Roman font option to “AE (Almost European)”.

You can further improve the rendering of text in your output by using microtype. Just add


… to the preamble. (These suggestions only apply if you’re using the pdflatex workflow as suggested above.)

Adding Footnotes in Tables

You might notice that adding footnotes in table cells doesn’t work. One answer to this is manually add them in ERT with \footnotemark and \footnotetext, possibly adjusting the counter as described in that FAQ entry.







17 responses to “LyX Tips for Thesis Writing”

  1. Diana Avatar

    Hi Mark,

    did you by chance encounter the problem that the font size (Times New Roman, 12 pt, Normal) was smaller than 12 pt in the pdf output? If yes, could you find a way to solve it?



    1. mark Avatar


      Sorry, I’m afraid I hadn’t come across that problem.

      I had various problems with the sizes of margins not being right, even though I entered them carefully in LyX, but I think that those turned out to be caused by me selecting options in Acrobat Reader’s print dialog that caused the page to be scaled when printing.

      Hope you manage to find a solution somewhere

  2. Magnus Avatar

    Fitting Tables Onto Pages

    Hi Mark,

    Im using your command to make tables as wide as the text width, but the command has the unwanted effect of scaling the text size up too :-S

    It does not work to set the text size to normal either… Do you know the magic trick?


    1. Magnus Avatar

      Let me just add: I am trying to make a quite narrow table stretch to fit the width of the text. Preferably with evenly sized columns.. The table is not too big, a problem that your code seems to be written to cope with. If you have any suggestions, they are very welcome.


    2. mark Avatar

      Sorry, I’m afraid I’m not sure – I’ve always wanted the text-scaling effect, personally.

  3. mgv Avatar

    Please help me, paragraph jistify not work and paragraph text out of right margin. Page size A4, Lyx 1.6, and MikTex 2.8

    1. mark Avatar

      Sorry, I’m afraid this isn’t a good place to ask for general questions like this – you’ll have better luck trying one of the LyX mailing lists or web forums:

  4. Jeremy Malcolm Avatar

    Actually Google will return the same results whether you searched for “colour” or “color”, so there’s no need to include both spellings. It even corrects for common mis-spellings.

  5. Shane Avatar

    Despite having my tables placed in the right sections Im finding a proble when looking at the pdf output of the document. The tables are coming out id the wrong sections i.e. above certain text instead of underneath it etc…Can you help please?

  6. Sid Avatar

    The command for fitting tables into a page is the most helpful thing I have ever seen in Lyx. Thanks! I have wasted hours trying to figure out the best way to include tables using Calc2latex etc. But I think the best option is just to use native Lyx tables. It makes it easy to refit, rotate, remove, paste lines etc.

  7. Tim Avatar

    Hi Mark,

    thanks for you tips. I have my standard text set to double spaced. Unfortunately, this setting is also applied to the captations in the floats. When I enter your suggestions in the preamble, I get LaTeX Error: File “Caption.sty” not found.” Do you have any suggestions?



  8. Qais Avatar

    I have problem in the PDF size which produced by LYX, it is too big. For example the size of PDF file of one chapter of my thesis (30 pages) is ~28MB. I have some images in this chapter and I tried to reduce the images size to 50% but I lost the resolution and the PDF size still too big!!!

  9. Peter Johnson Avatar
    Peter Johnson

    Hi there,

    I’m writing my thesis in LyX. Just wanted to say thanks for putting your tips online! The caption tip is great, and no doubt the other tips will come in handy too!


  10. Mike Avatar

    Hi Mark,

    I’ve just recently started using LyX as preparation for writing my thesis. Thank you for the informative tips. I was wondering if you have any tips for the actual design of figures? If you wanted a figure to take up the full page for example, how large in pixels, would you make the PNG file and so forth? Furthermore, if the figure contains numerous images, would you sort out the placement of these images in Inkscape and save them as one file or designate their position in LyX?


  11. waterfish Avatar

    Problems with sizes for different table:
    I am having problems setting up correct sizes of tables for lyx.
    1. Table 1 has 3 columns: set for 10%, 20%, and 70% (making a total of 100%)
    2. Table 2 has 4 columns: set for 10%, 20%, 30%, and 40%.
    3. Table 3 has 5 columns: set for 10$, 20%, 20%, 20%, and 30%.

    I need all the three tables of equal width. And they are not regardless of setting. However, if I set the three tables to 5 columns and then adjust accordingly, then the sizes are same. The idea is merging 3 columns to one for table 1 and 2 columns to 1 for table 2. This technique works. My question is “Is there a better way?”

    1. mark Avatar

      I’m afraid this isn’t a good place to ask LyX questions – I just put up these tips in the hope that they would be helpful. You might want to try to get help via one of the LyX mailing lists:

  12. Du Avatar

    Hi Mark,

    I am using the report class for my thesis. I am wondering if you know how can I change the “chapter” font, size, bold etc. Also for the index, how can create a “chapter….page” header and display chapter number, name and page like “1 INTRODUCTION……1”?

    Thanks a lot,