Software Tips & Tricks Håkon A. Hjortland NANO seminar 2010-03-03 Department of Informatics

advertisement
Software Tips & Tricks
Håkon A. Hjortland
Department of Informatics
University of Oslo
NANO seminar 2010-03-03
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
1 / 25
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
2 / 25
LATEX
Simple LATEX template
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
3 / 25
LATEX
Simple LATEX template
Files
Available at: http://haakoh.at.ifi.uio.no/latex/
Content:
latex-template-simple-1.0.0> fl
drwx------ 2 haakoh haakoh 4.0K
drwx------ 4 haakoh haakoh 4.0K
-rw------- 1 haakoh haakoh
64
-rw------- 1 haakoh haakoh 1.2K
-rw------- 1 haakoh haakoh 134
2010-03-03
2010-03-03
2010-01-10
2010-01-10
2010-01-10
07:02
07:11
03:35
04:15
01:24
./
../
fl
Makefile
personal.aspell
-rw------- 1 haakoh haakoh 4.0K 2010-03-03 06:51 document.tex
-rw------- 1 haakoh haakoh 2.8K 2010-01-10 01:22 bibliography.bib
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
4 / 25
LATEX
Simple LATEX template
Features (1)
Makefile (not used as a proper Makefile with dependencies).
Targets:
make: Do latex/bibtex compilation
Compile latex three times to update references
Compile bibtex
Show output only from last latex run
Remove files: .aux/.log/. . .
Makefile content:
@echo -------------------------------------------------------------------------------pdflatex -interaction nonstopmode $(OBJ).tex >$(OBJ).run 2>&1 || (cat $(OBJ).run; false)
@echo -------------------------------------------------------------------------------bibtex $(OBJ)
@echo -------------------------------------------------------------------------------pdflatex -interaction nonstopmode $(OBJ).tex >$(OBJ).run 2>&1 || (cat $(OBJ).run; false)
@echo -------------------------------------------------------------------------------pdflatex -interaction nonstopmode $(OBJ).tex
@echo -------------------------------------------------------------------------------rm -f $(OBJ).aux
rm -f $(OBJ).log
rm -f $(OBJ).bbl
rm -f $(OBJ).blg
rm -f $(OBJ).out
rm -f $(OBJ).run
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
5 / 25
LATEX
Simple LATEX template
Features (2)
(Continued. . . )
make check-spellcheck: Check spelling with aspell
make spellcheck: Interactively fix spelling errors with
aspell
make check-chktex: Check for typographic errors in latex
code using chktex
make check-pdf: Run pdfinfo and pdffonts. Especially for
IEEE papers: Avoid Type 3 (bitmap) fonts, and make sure
fonts are embedded and subset.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
6 / 25
LATEX
Simple LATEX template
Latex packages and commands (1)
Use very small paper margins:
\usepackage[cm]{fullpage}
Allow e.g. “foo.fig.pdf” filenames:
\usepackage[multidot]{grffile}
SIunits:
\usepackage[textstyle,binary,squaren]{SIunits}
$f=\unit{2.4}{\giga\hertz}$
Insert PDF documents into the latex document:
\usepackage{pdfpages}
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
7 / 25
LATEX
Simple LATEX template
Latex packages and commands (2)
Active links (web links, inter-document references). For nice
printouts, don’t use colors or other link markings:
\usepackage[pdftex]{hyperref}
\hypersetup{
% pdftitle={},
% pdfauthor={},
plainpages=false,
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
8 / 25
LATEX
Simple LATEX template
Latex packages and commands (3)
File listings:
\lstset{language=}
\lstset{basicstyle=\scriptsize}
\lstset{extendedchars=true}
\lstset{breaklines=true}
\lstset{frame=tb}
\newcommand{\lstmatlab}[1]{\lstinputlisting[language=Matlab,caption=#1,label=lst:#1]{#1}}
\newcommand{\lstMatlab}[2]{\lstinputlisting[language=Matlab,caption=#2,label=lst:#1]{#1}}
\newcommand{\lsttxt}[1]{\lstinputlisting[language=,caption=#1,label=lst:#1]{#1}}
\newcommand{\lstTxt}[2]{\lstinputlisting[language=,caption=#2,label=lst:#1]{#1}}
\lstmatlab{foo.m}
\lstMatlab{bar.m}{This is the bar.m file.}
See listing~\ref{lst:foo.m}.
Maximized graphics (commands included in the template file):
\includegraphics{foo.pdf}
\includegraphicsMaximize{foo.pdf}
\includegraphicsConstrainSize{foo.pdf}
\includegraphicsConstrainSizeScale{foo.pdf}{1.5}
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
9 / 25
LATEX
Simple LATEX template
Latex packages and commands (4)
Shorthand figure insertion:
\newcommand{\figuregfx}[2]{
\begin{figure}
\begin{center}
\includegraphics{#1}
\end{center}
\caption{#2}\label{fig:#1}
\end{figure}
}
\figuregfx{foo.pdf}{This is a figure of foo.}
See figure~\ref{fig:foo.pdf}.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
10 / 25
LATEX
Simple LATEX template
Other
epstopdf-emb-sub script: Embed and subset fonts to make
figures IEEE PDF eXpress compliant. Available at:
http://haakoh.at.ifi.uio.no/latex/
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
11 / 25
LATEX
Latexdiff
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
12 / 25
LATEX
Latexdiff
Latexdiff example (1)
Complete usage example available at:
http://haakoh.at.ifi.uio.no/latexdiff/
Basic usage: latexdiff old.tex new.tex >diff.tex
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
13 / 25
LATEX
Latexdiff
Latexdiff example (2)
Figure: PDF output from LATEX after using latexdiff on .tex-files.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
14 / 25
Source code management
Mercurial
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
15 / 25
Source code management
Mercurial
Mercurial SCM
Homepage: http://mercurial.selenic.com/
Distributed source code management / version control system
Usage:
hg
hg
hg
hg
hg
hg
hg
init
clone
commit -m ’Made some changes’
incoming
outgoing
push
pull
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
16 / 25
Source code management
Mercurial
hg-status
Small script to check status of a mercurial repository.
Available at: http://haakoh.at.ifi.uio.no/utils/
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
17 / 25
Source code management
Subversion
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
18 / 25
Source code management
Subversion
Homepage: http://subversion.apache.org/
Centralized source code management / version control system
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
19 / 25
Misc tips & tricks
Firefox keywords
Content
1
LATEX
Simple LATEX template
Latexdiff
2
Source code management
Mercurial
Subversion
3
Misc tips & tricks
Firefox keywords
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
20 / 25
Misc tips & tricks
Firefox keywords
Firefox keywords: Wikipedia search (1)
How to make a Firefox keyword to enable quick searching of
Wikipedia using Google.
Figure: Do a Google search.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
21 / 25
Misc tips & tricks
Firefox keywords
Firefox keywords: Wikipedia search (2)
Figure: Add bookmark of the search result.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
22 / 25
Misc tips & tricks
Firefox keywords
Firefox keywords: Wikipedia search (3)
Figure: Edit bookmark.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
23 / 25
Misc tips & tricks
Firefox keywords
Firefox keywords: Wikipedia search (4)
Figure: Use keyword.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
24 / 25
Misc tips & tricks
Firefox keywords
Firefox keywords: Wikipedia search (5)
Figure: Search result.
Håkon A. Hjortland (Univ. of Oslo)
Software Tips & Tricks
NANO seminar 2010-03-03
25 / 25
Download