## Tag Archive

amateur astronomy awk bash b[e] supergiant cartoon conference convert evolved star exoplanet fedora figaro fits fun galaxy iraf large magellanic cloud latex linux lmc machine learning magellanic clouds massive star matplotlib meteor mypaper paper peblo photometry planet pro-am pyraf python red supergiant scisoft skinakas observatory small magellanic cloud smc spectroscopy starlink talk ubuntu university of crete video x-ray yellow hypergiant

## LaTeX tip to comment out large portion of text

Not very obvious but:

\iffalse
blablabla
blublublublu

and some more bla here
\fi

so LaTeX doesn’t compile anything within this if clause.

[1] TeX.stackexchange- Commenting out large sections, accessed on Oct 10, 2016

## Struggling with BibTeX ???

Ok, it is time to try this promising thing called BibTeX [1,2,3], which allows you to use only one file with references* (suppose MyBibTeX.bib). Then, it easy to add references in any document just by simple adding the file and the citations. Although it seems rather straightforward hot to make the file its implementation is not.

So, first step is to add the file (or files separated with commas!) in you .tex document:
\bibliography{MyBibTeX}
[or even multiple files and in various locations, e.g. \bibliography{/path/to/bib,bib2,MyBibTeX} – by the way I did not notice any difference if extension .bib is kept or omitted!]

The second step is to add the style which will be used to represent the references. This is done by adding:
\usepackage{natbib} – at the preamble of the document and
\bibliographystyle{plainnat} – after/before \bibliography{}
to have the normal author-year style representation [3].

Now, to get proper representation of the references we have to compile the .bib file. This may seem a little complex (but you get used to this easily!):

• pdflatex afile.tex
• bibtex MyBibTeX.aux
• pdflatex afile.tex
• pdflatex afile.tex

[pdflatex or latex – depending on what you are using; see [3] for details]

In case on the error: “Bibliography not compatible with author-year citations
check that all your BibTeX entries include a year [4].
It is also important when making changes to the \bibliographystyle to remove the .aux and .bbl files completely [4].

Sources
[1] BibTeX.org: http://www.bibtex.org/ (retrieved 3/6/2014)
[2] Wikipedia: https://en.wikipedia.org/wiki/BibTeX (retrieved 3/6/2014)
[3] WikiBooks/LaTeX: https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management (retrieved 3/6/2014)
[4] TeX-stackexchange.com: https://tex.stackexchange.com/questions/54480/package-natbib-error-bibliography-not-compatible-with-author-year-citations (retrieved 3/6/2014)

*EXAMPLE of references inside a MyBibTeX.bib:

```@Book{testbook,
author    = "M. Up and G. Down",
title     = "Handbook of Testing TeX",
publisher = "OpenBooks",
year      =  2222,
edition   = "567th"
}
```

## ps2pdf behavior regarding page orientation with eps images

While writing a paper I was puzzled to see that although I was not putting anything in LaTeX code to affect the orientation of the page (Image 1), some pages were rotated at the final pdf file (Image 2). But why was that? Although I did play around to see if there was something wrong with the images, or the code, or whatever could possible go wrong with the LaTeX, the output was the same.

Image 1: The LaTeX code – nothing unusual here, just inserting some figures.

Image 2: The final pdf output. Clockwise: (1) a page with text, (2) a page with some figures properly shown, (3) the problematic page – it should be oriented as portrait and not landscape, (4) the next page with, properly displayed, plots.

From the final pdf document (Image 2, “page” 3) it is obvious that LaTeX does not do anything wrong. The page has the proper portrait orientation, but the pdf page is rotated. Looking around to see what could go wrong with the ps2pdf conversion I found out that:
“By default Ghostscript determines viewing page orientation based on the dominant text orientation on the page. Sometimes, when the page has text in several orientations or has no text at all, wrong orientation can be selected.” [1]

Since the images used are eps files [2], which means that they are text files, and they have plenty of text vertically oriented, Ghostscript takes their orientation as the proper one. When I manually run:
`ps2pdf -dAutoRotatePages=/None file.ps file.pdf `
these orientation issues removed.

Another idea is to use some extra invisible text (like white text in a white background) in order to increase the horizontal text. That way Ghostscript will select the right orientation from the beginning. A way to do it is presented in [3], but in my case it didn’t work well as it was also increasing the length of caption resulting in its displacement. Moreover, if highlighted the text become visible.

## LaTeX: wide figure or table in a 2 column document

Much simpler than I thought, but still I think it deserves a note in order not to forget it!

Simple add the * when using each element (figure/table)[1].
This will place it as wide as the page, but only at the top of the page.

## “Too many unprocessed floats” in LaTeX

`! LaTeX Error: Too many unprocessed floats.`
This error in LaTeX means that it is unable to handle more than a specific number of figures and tables (yes, there is a limit!  no more than roughly 30).

Unless you want to replot and combine figures an easy solution is to add the package ‘morefloats’:

\usepackage{morefloats}

(ref: UK TeX FAQ)