LaTeX and BibTex help

otispunkmeyer

Well-Known Member
Joined
May 15, 2006
Messages
4,829
Location
Loughborough UK
Car(s)
'03 Skoda Superb (farewell :(), '06 Honda Civic ES
Hey guys

just trying to get the hang of using LaTex for writing scientific reports. Its pretty swish I have to say.

Just teaching myself and I am looking at how to insert a bibliography at the end and cite documents from that bibliography in the main text.


At the moment I am trying to follow instructions that are on the Wiki but not getting anywhere. I have MacTex and I am using texmaker for my editor as its got this nice quick preview feature so I can see changes instantly. MacTex also came with BibDesk for bibliographies. I have just worked out how to use that. However when trying to get it all working it just isn't.

I have got this:

*text, sections etc*

...the cat sat on the mat said pat \cite{cite_key from BibDesk}

*blah blah, text, sections etc*

\bibliographystyle{plain}
\bibliography{TestRef1}
\end{document}


at the moment thats giving me:

...the cat sat on the mat said pat [?]

and no bibliography.


what am I missing? Is there a use package thing at the top I should have? I tried usepackage{natbib} but that doesn't seem to do anything
 

DanRoM

Forum Addict
Joined
Feb 27, 2009
Messages
9,905
Location
Ruhr Area, Germany
Car(s)
MX-5 ND, Tracer 900 GT & two bikes
You have to compile the document, then the bibtex file, then the document again, if I remember correctly (I've done that last several years ago...).

Checking an old work I did for uni, I had the \bilbiography before the \bibliographystyle, too. No idea if that's important, though.
 
Last edited:

otispunkmeyer

Well-Known Member
Joined
May 15, 2006
Messages
4,829
Location
Loughborough UK
Car(s)
'03 Skoda Superb (farewell :(), '06 Honda Civic ES
Yeah I read that you had to run Latex, then BibTex then Latex another two times. However I seem to get other errors (that don't show in Texmaker) when I do that. I have a document where I have just been trying things so its got images and equations and cross references etc and there seems to be a problem with it finding the image files. Don't know why.
 

DanRoM

Forum Addict
Joined
Feb 27, 2009
Messages
9,905
Location
Ruhr Area, Germany
Car(s)
MX-5 ND, Tracer 900 GT & two bikes
there seems to be a problem with it finding the image files.
Do the images have the right format? You need .jpg, .png or .pdf for PDF output, but .eps for PostScript output. In your \includegraphics the filename should be given without the suffix.
 

WillDAQ

Well-Known Member
Joined
Oct 23, 2007
Messages
2,725
Location
Ukania
It's a right old shuffle for bib updates, something like F11, F2, F11, F11, F2, F11, F1 just to be safe!

All images should really be .eps or .ps as you can then render to .ps (more reliable than the png, jpg, pdf route). If you need a pdf afterwards use ps2pdf.

Graphics should be:

\begin{figure} \centering
\includegraphics[scale=<number>]{<location relative to .tex file>}

\caption{<caption>}\label{<label>}

\end{figure}
 

otispunkmeyer

Well-Known Member
Joined
May 15, 2006
Messages
4,829
Location
Loughborough UK
Car(s)
'03 Skoda Superb (farewell :(), '06 Honda Civic ES
got it sorted now I think

I was trying to run it via the terminal, but it turns out Texmaker has the little drop down menu allowing you to run latex, bibtex, latex, latex etc in quick succession and this works. References and citations all come out in the wash perfectly.

I am using PDFLatex though as its much simpler for me to get my diagrams and stuff in a PDF/jpeg/png format rather than .eps. I see now that if I run just Latex it moans about the images, but PDFLatex has no trouble. Although then if you have an eps file, you must use the epstopdf package to handle eps files in PDFlatex (least thats how I understood it).

Only problem now is I have images showing up where they shouldn't be, but I am putting this down to using PDFLatex and then the epstopdf package to try out using eps files. It seems to be grouping all my images in one space rather than putting them in the correct sections.


If I just use Latex and eps files... how do I get a PDF output then? I assume the whole document is out put in a post script file? Just need to convert that to a PDF, easy as pie?
 

otispunkmeyer

Well-Known Member
Joined
May 15, 2006
Messages
4,829
Location
Loughborough UK
Car(s)
'03 Skoda Superb (farewell :(), '06 Honda Civic ES
btw, Wishing I got into this much earlier than now... Hasn't taken a day to get the basics. More complicated things are easily found with google. It just seems to be a bit of breeze compared to all the faffing about you do in word. Doing long/complex equations gets a bit messy in the code, but given the beautiful output you get its worth it.
 

Hidden_Hunter

Needs more IceBone
Joined
Oct 7, 2006
Messages
8,613
Location
Melbourne, Australia
Car(s)
'13 BMW 125i, '26 Buick Standard Six
btw, Wishing I got into this much earlier than now... Hasn't taken a day to get the basics. More complicated things are easily found with google. It just seems to be a bit of breeze compared to all the faffing about you do in word. Doing long/complex equations gets a bit messy in the code, but given the beautiful output you get its worth it.

my mum uses it extensively for her maths stuff, so much less fucking about with formatting compared to doing it in word (word has gotten better with dealing with maths equations though)
 

DanRoM

Forum Addict
Joined
Feb 27, 2009
Messages
9,905
Location
Ruhr Area, Germany
Car(s)
MX-5 ND, Tracer 900 GT & two bikes
Only problem now is I have images showing up where they shouldn't be, but I am putting this down to using PDFLatex and then the epstopdf package to try out using eps files. It seems to be grouping all my images in one space rather than putting them in the correct sections.
Are you sure LaTeX isn't just doing what it's supposed to do? It's exactly the point of the figure environment that it doesn't put the images exactly where they are in the source but rather where it's sensible to have them from a typesetting point of view. Perhaps you should play a bit with the placement options of the figure environment:
Code:
\begin{figure}[htbp]
...
\end{figure}
h = here, t = top of page, b = bottom of page, p = own page with images all over. Priority of options: first is highest. It's entirely optional.

If I just use Latex and eps files... how do I get a PDF output then? I assume the whole document is out put in a post script file? Just need to convert that to a PDF, easy as pie?
Just use pdflatex in the first place, then you can have all that fancy stuff like links in the table of contents and clickable URLs if you use the right packages.
If you need to have a PostScript output for printing, creating that is just a click away.
 
Last edited:

otispunkmeyer

Well-Known Member
Joined
May 15, 2006
Messages
4,829
Location
Loughborough UK
Car(s)
'03 Skoda Superb (farewell :(), '06 Honda Civic ES
DanRom that's sorted it. That HTBP option thing at the end. I had no idea what that was for so just had them all copied in from an example!!
 
Top