Latex Usage Notes
Tips, References, etc. for Latex, Lyx, Miktex, Bibtex, etc.
- Nice general reference: http://www.markschenk.com/tensegrity/latexexplanation.html
References
- Lyx made easy: http://www.tuxradar.com/content/lyx-made-easy
- GREAT little intro to Latex: http://www.electronics.oulu.fi/latex/examples/example_1/index.html
- Quick and dirty guide to Latex: http://happymutant.com/latex/
- Great guide on how to Latex: http://www.scribd.com/doc/451344/Howto-LaTeX
- GREAT guides to Latex, Miktex, Bibtex, etc.: http://www.geocities.com/kijoo2000/
- Dissertation and Latex Resources: http://www.utexas.edu/ogs/etd/LaTeX/Resources/from.quick+dirty/ltxmaths.html
- Latex symbols cheatsheet: http://omega.albany.edu:8008/Symbols.html
- Typesetting Math in Latex (including spaces): http://crab.rutgers.edu/~karel/latex/class5/class5.html
- Nice general introduction to Latex documents, bibliographies, images, etc.: http://andy-roberts.net/misc/latex/
- Fonts in Latex: http://www.image.ufl.edu/help/latex/fonts.shtml
- Typesetting: http://www.macfreek.nl/mindmaster/Fonts_in_LaTeX
- Using Bibliography and Citations in Latex: http://cs.guc.edu.eg/research/latex_online_tutorial/LaTeX/LaTeX_05/latex_bibtex_01.html
- Bibtex notes: http://andy-roberts.net/misc/latex/latextutorial3.html
- Using bibtex in Lyx: http://forums.opensuse.org/applications/401430-how-bibtex-lyx-os11.html
- Lyx Manual on Customization: http://wiki.lyx.org/uploads/LyX/Manuals/1.4.2/Customization.pdf
- MikTex Customization Notes: http://www.artofproblemsolving.com/LaTeX/AoPS_L_GuidePack.php
- Nice Latex Notes by Jason Rennie: http://people.csail.mit.edu/jrennie/latex/
Jabref/Bibtex Notes
- Jabref exports to Word 2007 XML: http://www.paulkiddie.com/2009/07/jabref-exports-to-word-2007-xml/
Latex Only Notes
- To use Harvard-style of author-year, use the following in the preamble, then use
\citepin the text, and don ’t forget to compile three times:
\usepackage{babel}
\usepackage{natbib}
- Natbib reference: http://merkel.zoneo.net/Latex/natbib.php
- Use Jurabib instead?
- Lyx and Jurabib: http://www.groupedia.com/content/lyx-and-jurabib
- Fixing Lyx and Jurabib: http://lyx.475766.n2.nabble.com/Jurabib-and-Harvard-td479843.html
- Making \citep the default: http://www.mail-archive.com/lyx-users@lists.lyx.org/msg79908.html
- Bibliographies in Lyx for Humanities: http://wiki.lyx.org/LyX/HumanitiesLyX#bibliographies
- Overall guide to Latex and BibTex: http://www.andy-roberts.net/writing/latex/bibliographies
Convert from/to Latex
- Best guide ever: http://www.charlietanksley.net/philtex/converting-to-latex/ Talks about converting Word (.doc/.docx), PDF, ABW, etc., to Latex using open source tools
Making Scientific Posters
- CVPR Poster Presentation Instructions: http://cvpr2011.org/posterinstructions
- Nice Poster Template: http://cvpr2011.org/sites/default/files/CVPR11-poster-template.ppt
- Free Research Poster Templates: http://www.posterpresentations.com/html/free_poster_templates.html
- Tips for creating a poster: www.son.washington.edu/dl/seminars/1-26-04/PostersTips.doc
- Latex Poster Template: http://www.brian-amberg.de/uni/poster/
Latex Usage Notes
- 1-column abstract in 2-column document: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=onecolabs
\documentclass[twocolumn]{article}
...
\begin{document}
... % \author, etc
\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\begin{abstract}
...
\end{abstract}
\end{@twocolumnfalse}
]
For lyx, just used:
\twocolumn[
\begin{@twocolumnfalse}
... non-ERT ...
\vspace{10 mm}
\end{@twocolumnfalse}
]
- Make a title:
\newcommand{\makeTitleQuote}[1]%
{\hspace*{-\marginparsep minus \marginparwidth}%
\begin{minipage}[t]{\textwidth}% \textwidth+\marginparwidth+\marginparsep
{\large \bfseries #1}\\[-0.15\baselineskip]%
\rule{\columnwidth}{1pt}%
\end{minipage}}
- To add a running header:
\usepackage{fancyheadings}
\pagestyle{fancy}
%Width of line below running headers (0pt means no line)
%\setlength{\headrulewidth}{1pt}
%\renewcommand{\headrulewidth}{1pt}
\def\schoolName{School Name} % CHANGE: School Name
\lhead{Ricky J. Sethi}
%\chead{Ricky J. Sethi}
\rhead{Research Statement 2010}
%\rfoot{Cover Letter for \schoolName}
- To add a graphic to the running header, use the graphicx package and
\includegraphicscommand: http://www.latex-community.org/forum/viewtopic.php?f=47&t=3888 - EXCELLENT reference for header settings: http://en.wikibooks.org/wiki/LaTeX/Page_Layout
- Great reference for fancy header settings: http://texblog.wordpress.com/2007/11/07/headerfooter-in-latex-with-fancyhdr/
Lyx Usage Notes
- Simple guide to all aspects of Lyx: http://www.stat.rice.edu/~helpdesk/howto/lyxguide.html
- Used the
amsalphastyle in BibTex Bibliography dialog box - Can add multiple modules like
theorem(which contains theorems, definitions, etc.) by selectingDocument → Modules - If you get errors of
Undefined Control Sequencefor theEqRefmacros, just go toDocument → Settings → Latex Preambleand then add\usepackage{amsmath} - If you have trouble with references to algorithms, add
\newcommand{\theHalgorithm}{\arabic{algorithm}}to the preamble, as per http://www.mail-archive.com/lyx-users@lists.lyx.org/msg10118.html
- To set the format of the
Insert → Datein Lyx, go toTools → Preferences → Date, as per http://comments.gmane.org/gmane.editors.lyx.general/67391
- If you have trouble with table numbering where it skips a number, it ’s likely due to a long table and you need to add the following to the preamble:
\let\myEnd\endlongtable \renewcommand\endlongtable{\myEnd\addtocounter{table}{-1}}as per http://texnik.dante.de/cgi-bin/mainFAQ.cgi?file=table/longtable#caption - If you have trouble with converting a
.texfile to a.lyxfile, try this from acmdprompt:
"c:\Program Files\LyX16\bin\tex2lyx.exe" -f infile.tex [outfile.lyx]
This should show the errors (usually, it ’s just an unknownDocument classso you need to add it to Miktex and create a layout for it first; if it gives an error on class not loaded/unable to load class, make sure theInputcommands are all valid; e.g., ensurealgorithm.incis installed previously if youInput algorithm.inc). - Algorithm Package for Lyx: Used in Book Chapter on Gait: Get the algorithm package for Lyx from: http://bgu.chez-alice.fr/
- Copy
algorithm.incandarticle-algo.layouttoC:\Program Files\LyX16\Resources\layouts - Put the
algolyx.styin Latex by putting it in a new folder calledalgolyxinC:\Program Files\MiKTeX 2.7\tex\latex - Next run MikTex ’s
Settingsand thenRefresh FNDB- Might also have to run
Update Formats
- Then run
Tools → Reconfigurein Lyx - Finally, add the following to each
.layoutyou ’re using likeC:\Program Files\LyX16\Resources\layouts\IEEEtran.layout
# Input lyx algorithm definitions Input algorithm.inc
UCR Thesis Templates in Lyx
Got the template from Kara; also available online at: http://www.math.ucr.edu/~jason/latextemplate/
- Copy the following files to
C:\Program Files\MiKTeX\tex\latex\ucrsw20uctd.sty,thmsupp.tex,ucr.cls,uct10.clo,uct11.clo,uct12.clo
- Next run MikTex ’s
Settingsand thenRefresh FNDB - Create the following layout file,
ucr.layout, inC:\Program Files\LyX16\Resources\layouts:
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[ucr]{article (ucr)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions (only if you've installed the algorithm package for Lyx from: http://bgu.chez-alice.fr/) Input algorithm.inc - Finally, run
Tools → Reconfigurein Lyx - Next,
Importthe fileuctest.texinto Lyx- Remove the
TitleandAuthorand, instead, add all the lines from\titleto\maketitleinto an ERT (a Tex Code box) since the\maketitlecommand Lyx inserts right after Title or Author causes a premature compilation error where it says\maketitlewas not def ’ed; solution was as per here - Also, had to add
\setlength\headsep{-0.5in}to theLatex Preamblein order to ensure the top margin isn ’t too large, as per: http://www.math.ucr.edu/~jason/latextemplate/ - Also, had to change textheight to
\textheight = 8.50inin theLatex Preamblefrom8.25in - Had to comment out
\newtheorem{algorithm}[theorem]{Algorithm}in theLatex Preamble, as well, in order to avoid errors when I include algorithms in the paper (since I add the algorithm style msyelf) - Finally, Kara wanted me to change to a darker font so I added
\usepackage{palatino}to theLatex Preamble, as per http://www.image.ufl.edu/help/latex/fonts.shtml- Instead, to change fonts, check here: http://stackoverflow.com/questions/877597/how-do-you-change-the-document-font-in-latex
Using Scientific Journal/Conference Templates in Lyx
- BMVC: Adding/Using BMVC ’s
.clsand.styfiles:- Put (as detailed below)
bmvc2k.cls,bmvc2k_natbib.sty, andbmvc2k.bstin a new folder calledbmvc2kinC:\Program Files\MiKTeX 2.7\tex\latex - Create and add the
bmvc2klayout inC:\Program Files\LyX16\Resources\layouts\bmvc2k.layout
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[bmvc2k]{article (bmvc2k)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions Input algorithm.inc - Then run MikTex ’s
Settings(and thenRefresh FNDB) and thenTools → Reconfigurein Lyx - Also, had to add
subfigure.stypackage from theftp://ftp.fu-berlin.de/repository since the original repository was giving anremote package repository is corruptederror - Finally, had to comment out this line in
bmvc2k.cls:\usepackage[sort,numbers]{bmvc2k_natbib}And, instead, usedDocument → Bibliography → Natbib (Numerical)in order to avoid the following error:Argument of \NAT@xcom has an extra }.which turns out to be a natbib error of some sort that Lyx creates (the original .tex works just fine)- Still used
bmvc2k.bstas the style for the bibliography in Lyx
- ACM Multimedia (ACMM): Adding/Using ACMM ’s
.clsfile:- Put (as detailed below)
sig-alternate.clsin a new folder calledsig-alternateinC:\Program Files\MiKTeX 2.7\tex\latex- For the review version, I removed the
\@copyrightspacefrom\maketitleinsig-alternate.clsto save space on the copyright block - If you want to cut the space between the title and text, change
-12.75pcto-10.75pcin\advance\dimen0 by -12.75pc\relax % Increased space for title box – KBT - Can also change how low text extends by changing
\textheight 666pt % 9 1/4 column heightto\textheight 706pt % 9 1/4 column height- For CI Fellows, ended up making
\advance\topmargin by -65pt % Leave 37pt above text for headersinstead of\advance\topmargin by -37pt % Leave 37pt above text for headersand\textheight 733pt % 9 1/4 column height
- Create and add the
sig-alternatelayout inC:\Program Files\LyX16\Resources\layouts\sig-alternate.layout
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[sig-alternate]{article (sig-alternate)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions Input algorithm.inc - Then run MikTex ’s
Settings(and thenRefresh FNDB) and thenTools → Reconfigurein Lyx - ACM also requires the bib entries in the
.texfile; here ’s a guide on how to do it in Lyx: http://wiki.lyx.org/Examples/AcmSigplan- Basically, export to
.tex, then runlatex name.tex, thenbibtex nameand then copy and paste contents of the.bblintoname.tex
- ACM also requires the bib entries in the
.texfile; here ’s an automated script to do it: http://www.lyx.org/trac/ticket/4624
- ACM CSCW: Adding/Using SIG CHI ’s
.clsfile:- Put (as detailed below)
chi2009.clsin a new folder calledchi2009inC:\Program Files\MiKTeX 2.7\tex\latex - Create and add the
chi2009layout inC:\Program Files\LyX16\Resources\layouts\chi2009.layout
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[chi2009]{article (chi2009)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions Input algorithm.inc - Then run MikTex ’s
Settings(and thenRefresh FNDB) and thenTools → Reconfigurein Lyx - Ran into a problem with the bibliography definitions in the
chi2009.clsfile- As per here, when the references are just question marks, the problem is either the format setup in the
.clsfile or weird characters in the.bibfile: http://www.latex-community.org/forum/viewtopic.php?f=4&t=3359 - Replaced the bibliography sections in the
chi2009.clsfile (from
%%% Actually, 'abbrev' works just fine as the default - Gerry
to
\gdef\balancecolumns
)- Just went with bibliography Citation style
Default (numerical)and first choseplainas style and then switched toabbrvas style
- Replaced with the part it says (but had to remove the
\newcommand\sectionpart as it conflicted):
\setlength \labelsep {.5em} \newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em} \let\@openbib@code\@empty \newcommand\refname{References} \newcommand\section{\@startsection {section}{1}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\normalfont\Large\bfseries}} \newenvironment{thebibliography}[1] {\section*{\refname}% \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}% \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}% \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty \widowpenalty4000% \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist}
- Springer/IJCV (ACCV also uses LNCS/llncs): For their Lecture Note Style ONLY, don ’t need this and can use the built-in LyX-provided documentclass
article (Springer LNCS); otherwise, download from here- Copy the
svglov3.cloandsvjour3.clsfiles provided by Springer toC:\Program Files\MiKTeX\tex\latex\sv-journ3 - Next run MikTex ’s
Settingsand thenRefresh FNDB - Create the following layout file
svjour3.layoutinC:\Program Files\LyX16\Resources\layouts:
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[svjour3]{article (svjour3)} # Input general definitions Input stdclass.inc - Then, add the following to
svjour3.layout:
# Input lyx algorithm definitions Input algorithm.inc - Finally, run
Tools → Reconfigurein Lyx
- IEEE/tPAMI Journal: Follow directions in
General Directions to Add Classesbelow- Did not need to do above for
IEEEtran.clsas that was already in Lyx. All I had to do was load the shell (bare_jrnl.tex) and then go toDocument → Settings → Document Classand then addpeerreviewtoCustom
- NIPS Conference: Follow directions in
General Directions to Add Stylesbelow- Did this for NIPS conference: had to add a
.styfor NIPS (it builds upon thearticleclass). - Add everything before
\begin{document}in the original.texfile to theLatex Preamble- Optionally, add
\usepackage{nips07submit_e}to theLatex Preamble, too
- In Lyx ’s
Document → Settings → Document Class, make sure you useArticle (algo)and notarticleas the base class as the former includes theInput algorithm.incdirective
- CVPR: Adding/Using CVPR ’s
.styfiles and template:- Put (as detailed below)
cvpr.sty,cvpr_eso.sty, andeso-pic.styin a new folder calledcvprinC:\Program Files\MiKTeX 2.7\tex\latex - Next run MikTex ’s
Settingsand thenRefresh FNDB - Now you are able to include your package in the usual way:
\usepackage{cvpr}, where you don ’t include the.styin the file name in the\usepackagestatement- For Lyx, when you import the
egpaper_for_review.textemplate, it adds the\usepackage{cvpr}and other lines into theDocument → Settings → Latex Preamble
- ECCV: Adding/Using ECCV ’s
.clsand.styfiles:- Put (as detailed below)
llncs.cls,lineno.sty, andsplncs.bstin a new folder calledllncsinC:\Program Files\MiKTeX 2.7\tex\latex - Create and add the
llncslayout inC:\Program Files\LyX16\Resources\layouts\llncs.layout
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[llncs]{article (llncs)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions Input algorithm.inc - Then run MikTex ’s
Settings(and thenRefresh FNDB) and thenTools → Reconfigurein Lyx - Add the following to the document ’s Preamble:
Document → Settings → Latex Preamble
\usepackage{lineno}\@ifundefined{definecolor} {\usepackage{color}}{}This will likely be added automatically when you importeccv2010submission.tex - Finally, put everything between
\begin{document}and\begin{abstract}intoERTat the top of the document and edit as needed.- Also, add
\usepackage{times}in the Preamble to use the “Times, Helvetica, Courier ” defaults, if necessary
- Cambridge University Press: Used in Book Chapter on Gait:
- Create and add the
cupbooklayout inC:\Program Files\LyX16\Resources\layouts\cupbook.layout- Added in
algorithm.inc, too (as long as it ’s already installed)
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[cupbook]{article (cupbook)} # Input general definitions Input stdclass.inc # Input lyx algorithm definitions Input algorithm.inc
- Add
cupbook‘s.clsand.styfiles to Miktex ’s directory:C:\Program Files\MiKTeX 2.5\tex\latex\cupbook - Then run MikTex ’s
Settings(and thenRefresh FNDB) and thenTools → Reconfigurein Lyx - For adding a
.styto MikTex, see: http://www.artofproblemsolving.com/LaTeX/AoPS_L_GuidePack.php- Specifically, add the
.styfile toC:\Program Files\MiKTeX 2.5\tex\latex
General Directions to Add Classes
Reference: http://wastedmonkeys.com/2007/09/27/adding-a-new-class-in-lyx-windows
- Copy the
xxx.clsfile in~\miktex###\tex\latex\(where ### is the version (may or may not exist)) - Make a layout file matching the class file (
xxx.layout) like this (you may add extra settings), replacing xxx by your class name in the layout file:
#% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[xxx]{article (xxx)} # Input general definitions Input stdclass.inc - Copy this file to the
\Lyx###\Resources\layouts\ - Go to
Start > Run; type incmdand press enter ; on the command prompt typetexhash - In LyX, do:
Tools > Reconfigure ; Restart Lyx
General Directions to Add Styles
- Add the
.styto MikTex- Create a file for the information you ’d like to include in multiple files and name it something with a
.styextension, such as mylay.sty or mycommands.sty. - Put in the
.styfile all the commands you ’d like to use in multiple source files and save the file. - You have two options for where to save the file to be able to include it in LaTeX source files:
- (Recommended) Install the .sty file with MiKTeX as follows:
- Navigate to the folder where LaTeX packages get installed. If you accepted the default location when you installed MiKTeX, this folder is probably
C:\Program Files\MiKTeX 2.5\tex\latex - Create a new folder inside this folder and call it whatever you want.
- Save your .sty file into this folder.
- Open the MiKTeX
Settings(old: Options) program. (You can do this by clickingStart → All Programs → MiKTeX → MiKTeX Settings) - Click
Refresh FNDBon the window that opens. Now you should be able to use any information in that.styfile in any LaTeX source file.
- Simply put your
.styfile in the same folder as your source files. Unfortunately, this means if you have LaTeX source files in other folders, you ’ll have to carry copies of your.styfiles to those folders, too. The real problem with this approach comes when you want to change one of these files, you have to change all those copies.
- Now you are able to include your package in the usual way:
\usepackage{your file name}, where you don ’t include the.styin the file name in the\usepackagestatement. - You can now call any command you have created in your
.styfile.
- Add the
.styto Lyx- Go to:
C:\Program Files\LyX16\Resources\layouts - For the sake of example well assume that the style file is called
myclass.styand it is meant to be used withreport.clswhich is a standard class.
cp report.layout myclass.layout
- Then edit
myclass.layoutand change the line:\DeclareLaTeXClass{report}to read\DeclareLaTeXClass[report, myclass.sty]{report (myclass)} - Then add the following near the top of the file:
Preamble \usepackage{myclass} EndPreamble - Finally, Run
Tools → Reconfigurein Lyx
- Edit the Document ’s Preamble
- Go to
Document → Settings - Change the
Document Classto your new class - Add everything before
\begin{document}in the original.texfile to theLatex Preamble

Không có nhận xét nào:
Đăng nhận xét