You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Lyx How-Tos

Making Figures

Many figures come from PowerPoint diagrams and Excel or Mathcad graphs, and getting these figures to look good in the LyX pdf, with nice crisp lines and clear text, is somewhat difficult. The only language LyX, Excel, Mathcad, and PowerPoint all speak is pdf. Here is the recommended procedure:

  1. Open your image in the program you made it in.
  2. Print the image (e.g. by selecting File >> Print for just one PowerPoint slide) and select "Adobe PDF" as your printer.
  3. Go to "Properties" for the printer, and select "ASCE pdf figures" to use an ASCE driver that makes high-quality pdfs when you print files.  Also, uncheck the box in the printer properties window that says "Rely on system fonts only; do not use document fonts."  This will make the text look better.  The ASCE driver can be downloaded from the Web-o-net, but Cmail won't let me attach the .exe installer file to an email.
  4. Sadly, the pdf you made by making printing your file will have large white spaces around it.  There is nothing you can do in the printer settings to change this - trust me, I checked for well over an hour.  Instead, take your pdf image files on a flash drive over to Carpenter Hall (or some other computer that has Adobe Acrobat and not just Reader), and use the "Crop" tool (under View >> Tools >> Page in Adobe Acrobat) to crop out the white spaces around your image.
  5. Once your images have been cropped, they are ready for insertion into LyX.  You can add pdf images using the Insert >> Graphics command like you would do with any image file.
  6. When you make your LyX file into a pdf, the figures will look really good.  They will retain their character as vector images and will be "crisp" and not pixellated at any level of zoom.

Stuff You Can't Do in Menus

An overarching theme of the next few sections is that there are many things in LyX and its associated programs (chiefly BibTeX) that you cannot change easily in menus or other user controls.  LyX makes a lot of decisions for you, and some of them will inevitably not make your document look good.  Your page numbering defaults to starting at 1, putting your title page on page 1 and your table of contents awkwardly around page 10.  If you cite a source like a report by "American Society of Civil Engineers," your in-text citations will be (Engineers, 2009) and your bibliography will assume that the author is a person named, "Engineers, A.S.C."  If there is an article in your references list with a title that includes a word like "Honduras," it will show up in lower case letters automatically.  And if you were tempted to have a references list at the end of each chapter of your thesis, you can add two database files ... but a lot of your references will disappear. 
All of these examples have two things in common:  (1) I spent many hours figuring out how to fix each of them, and (2) there is nothing you can do in the menus, user options, etc. in LyX that make any of these problems go away.  It was not just helpful but essential that I learn quite a bit of the nuts and bolts of LaTeX and BibTeX coding to complete my thesis.  There was no way around this. For me this was difficult because I have no background whatsoever using TeX or Linux, and the info available online tends to be written for a very high-level computer science audience.  LyX pretends to be a totally user-friendly program that eliminates the need to use LaTeX coding.  DON'T BELIEVE IT!!!!!

Page Numbering

It is possible to get Roman numerals on your pages before and up to your table of contents, and Arabic numerals starting on the first page of your actual text.  You need to do this by inserting LaTeX code boxes in the right places:  \pagenumbering

Unknown macro: {roman}

 and \thispagestyle

Unknown macro: {empty}

 right before your title does two things:  it gets rid of page numbering on your title page, and starts using Roman numerals for the beginning of the document and until further notice.  Then, after your Table of Contents, List of Figures, and List of Tables (each spaced by a page break), add another page break before Chapter 1 of the actual text and add another LaTeX command to switch to Arabic numerals:  \pagenumbering

Unknown macro: {arabic}

Making Bibliographies I - formatting references and citations

I put together my bibliography in RefWorks online, and exported a BibTeX file from RefWorks.  This step is not too difficult, but does require one important step:  the file that RefWorks sends you, even though it is meant for BibTeX, has the .txt (text file) extension.  You have to change this to .bib before it will work.  I have XP Home Edition on my laptop so I did this with a DOS prompt.  Other operating systems let you simply rename the file out of the explorer menu.
Once your file is in the .bib form, you are often far from done.  The online libraries and indices have many inconsistencies in the way they enter references, so some of your journal articles will come back with:

  • symbols like "&" that you have to delete because LyX cannot display them
  • journal titles in all caps, which you have to change
  • authors' first names, which must be changed to initials
  • authors' first and last names reversed, so (Mintz et al., 2008) might become (E et al., 2008)

Theoretically it is possible to get rid of all this stuff in RefWorks, but it is hard to catch everything.  I ended up just opening the BibTeX database file and making all of these changes by hand to be darn sure that it was all correct.  I found this easier than making the changes on RefWorks pre-exporting.
The other key lesson is that you can use an extra set of braces to "fix" the text of a reference to make it appear EXACTLY as you want it to look.  Here is a typical examples of a BibTeX entry where I used the double braces method to get things to show up correctly - in this case, to capitalize things as I wanted them to appear in the article title because it defaults to lower case.
@article{RefWorks:58,

        author={C. B. Yang and Y. L. Cheng and J. C. Liu and D. J. Lee}

,

        year=

Unknown macro: {2006}

,

        title=Treatment and reuse of backwash water in Taipei water treatment plant, Taiwan,

        journal=

Unknown macro: {Water Science and Technology - Water Supply}

,

        volume=

Unknown macro: {6}

,

        number=

,

        pages=

Unknown macro: {89-98}

Making Bibliographies II - non-traditional authors

I also figured out a workaround for citing a report where the author is something like ASCE or US EPA.  It consists of two basic steps - the BibTeX entry and the in-text citations.  We will use the example of the "Report Card for America's Infrastructure" by the American Society of Civil Engineers, 2009.  Here is how I formatted it in BibTeX with the "fixed braces" method:
@misc{RefWorks:34,

       author=American Society of Civil Engineers (ASCE),

       year=

Unknown macro: {2009}

,

       title=2009 Report Card for America's Infrastructure,

       journal=

Unknown macro: {Infrastructure Report Cards}

,

       month=

Unknown macro: {May 24, 2011}

,

       url={http://www.infrastructurereportcard.org/report-cards{color:#222222}}
I have been using the "ascelike" convention to format my bibliography, and bizarrely it is the case that the "Journal" line is needed in order for quotes to properly appear around the title of a misc or online reference.  Written this way, it showed up fine in my bibliography.
Now, I needed a way to make it appear correctly for in-text citations.  I wanted it to appear as (ASCE, 2009).  The first step was to add some code to the LaTeX preamble (Document >> Settings >> LaTeX preamble) for each reference whose default in-text citation I wanted to change.  The syntax is:  \defcitealias

Unknown macro: {RefWorks}
Unknown macro: {scshape ASCE, 2009}

.  In order to use this, you cannot simply add a citation from the menu as you would with other references.  Instead, where you want (ASCE, 2009) to show up in the pdf file, you need to make the citation in LaTeX code.  For this example, the syntax is:  \citepalias

Making Bibliographies III - sectioning

The final challenge with bibliographies is getting them to section.  I wanted a unique list of references at the end of each chapter of my thesis, and that ended up requiring many steps:

  1. Make a BibTeX file for each chapter by tagging your RefWorks entries with Paper 1, Paper 2, etc. and generating a file that includes only the references for each chapter
  2. Add the appropriate BibTeX file corresponding to each chapter at the end of that chapter, by using Insert >> List/TOC >> BibTeX Bibliography. 
  3. Change the settings in your document to a sectioned bibliography, using Document >> Settings >> Bibliography and selecting the box that says "Sectioned bibliography."  Also, change the Processor option from Default to BibTeX.  Note that you are now almost there, but it will not yet work if you are using a computer that does not have the required BibTeX package installed to handle a sectioned bibliography (in this case, it's called bibtopic)
  4. Install or activate the texmf-texlive\bibtex package.  I have done this on the Linux computer - it was there but inactive - so it should now work at least on this machine.
  5. Add two lines of code to your LaTeX preamble that say:  \usepackage[dot]
    Unknown macro: {bibtopic}
     and \usepackage
    Unknown macro: {natbib}
    .  This convinces LyX to use the packages you need.
  • No labels