<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JosteinB &#187; LaTeX</title>
	<atom:link href="http://josteinb.com/category/programming/latex/feed/" rel="self" type="application/rss+xml" />
	<link>http://josteinb.com</link>
	<description>The blog with the awesome slogan</description>
	<lastBuildDate>Sun, 17 Jul 2011 18:09:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Making international characters searchable in LaTeX documents</title>
		<link>http://josteinb.com/2010/01/making-international-characters-searchable-in-latex-documents/</link>
		<comments>http://josteinb.com/2010/01/making-international-characters-searchable-in-latex-documents/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:01:58 +0000</pubDate>
		<dc:creator>Jostein</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[font encoding]]></category>
		<category><![CDATA[international characters]]></category>

		<guid isPermaLink="false">http://josteinb.com/?p=119</guid>
		<description><![CDATA[By default LaTeX generates some international characters in a weird way when building a PDF and so on. For example, the norwegian Å will be represented as ˚A, and thus making any word containing the letter impossible to find when searching for it. This can be solved by using the package fontenc, with the parameter T1 [...]


Related posts:<ol><li><a href='http://josteinb.com/2009/12/citing-displaying-source-code-in-latex/' rel='bookmark' title='Citing / displaying source code in LaTeX'>Citing / displaying source code in LaTeX</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>By default LaTeX generates some international characters in a weird way when building a PDF and so on. For example, the norwegian Å will be represented as ˚A, and thus making any word containing the letter impossible to find when searching for it. This can be solved by using the package fontenc, with the parameter T1 like this:</p>
<p>\usepackage[T1]{fontenc}</p>
<p>Now everything (at least for norwegian documents) should be working as expected.</p>


<p>Related posts:<ol><li><a href='http://josteinb.com/2009/12/citing-displaying-source-code-in-latex/' rel='bookmark' title='Citing / displaying source code in LaTeX'>Citing / displaying source code in LaTeX</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://josteinb.com/2010/01/making-international-characters-searchable-in-latex-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citing / displaying source code in LaTeX</title>
		<link>http://josteinb.com/2009/12/citing-displaying-source-code-in-latex/</link>
		<comments>http://josteinb.com/2009/12/citing-displaying-source-code-in-latex/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 12:24:58 +0000</pubDate>
		<dc:creator>Jostein</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[listing]]></category>
		<category><![CDATA[lstlisting]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://josteinb.com/?p=96</guid>
		<description><![CDATA[I am writing my master thesis using LaTeX, a typesetting system most commonly used for scientific documents.  Since my thesis is in computer science, I have the need to display a fair amount of code.  After searching around the net and with some trial and error, I have come up with some settings that does [...]


Related posts:<ol><li><a href='http://josteinb.com/2010/01/making-international-characters-searchable-in-latex-documents/' rel='bookmark' title='Making international characters searchable in LaTeX documents'>Making international characters searchable in LaTeX documents</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I am writing my master thesis using <a title="latex project" href="http://www.latex-project.org/" target="_self">LaTeX</a>, a typesetting system most commonly used for scientific documents.  Since my thesis is in computer science, I have the need to display a fair amount of code.  After searching around the net and with some trial and error, I have come up with some settings that does this in a nice way.</p>
<p>It is based on the listings package, we define a lstset that handles the code.  This in combination with a nice caption makes for a nice presentation of source code.</p>
<p>Here is the final result:</p>
<div id="attachment_97" class="wp-caption alignnone" style="width: 460px"><img class="size-full wp-image-97 " title="latex_screenshot" src="http://josteinb.com/wp-content/uploads/2009/12/latex_screenshot1.png" alt="LaTeX Source Code Screenshot" width="450" height="169" /><p class="wp-caption-text">LaTeX Source Code Screenshot</p></div>
<p>&#8220;Read more&#8221; for the rest of the article</p>
<p><span id="more-96"></span></p>
<p>The packages needed are:</p>
<ul>
<li>\usepackage{listings}</li>
<li>\usepackage{cite}</li>
<li>\usepackage{caption}</li>
<li>\usepackage{upquote}</li>
<li>\usepackage{xcolor}</li>
<li>\usepackage{xcolor}</li>
</ul>
<p>We now define the caption as:</p>
<p>\DeclareCaptionFont{white}{\color{white}}<br />
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}<br />
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}</p>
<p>This makes a gray box for the caption, with white text.</p>
<p>Now define the lstset with the following:</p>
<p>\lstset{<br />
language=Java,<br />
keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},<br />
identifierstyle=\ttfamily,<br />
commentstyle=\color[rgb]{0.133,0.545,0.133},<br />
stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},<br />
showstringspaces=false,<br />
basicstyle=\small,<br />
numberstyle=\footnotesize,<br />
numbers=left,<br />
stepnumber=1,<br />
numbersep=10pt,<br />
tabsize=2,<br />
breaklines=true,<br />
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},<br />
breakatwhitespace=false,<br />
aboveskip={1.5\baselineskip},<br />
columns=fixed,<br />
upquote=true,<br />
extendedchars=true,<br />
frame=bottomline,<br />
inputencoding=utf8<br />
}</p>
<p>The language must obviously be changed to the language  you are using, to provide the correct syntax coloring.</p>
<p>the numbers parameter chooses whether to show line numbers or not, the prebreak parameter adds an arrow to indicate that the line is broken.  The upquote parameter ensures that no fancu &#8220;&#8216;s are used, so that you can copy the code and still be able to run it.  The other parameters should be self-explanatory, and can be modified as you see fit.</p>
<p>To use this in your document, you can insert code directly with:</p>
<p>\begin{lstlisting}[label=some-samplecode, caption=Example for code straight from the .tex file]</p>
<p>&lt;insert code here&gt;</p>
<p>\end{lstlisting}</p>
<p>or you can insert code from an external file using:</p>
<p>\lstinputlisting[label=samplecode,caption=Example for code from a file]{sourceCode/K53.java}</p>
<p>all of these can now be referenced from other places in the document with the \ref{labelname} command, and will show up in your overview of listings.</p>


<p>Related posts:<ol><li><a href='http://josteinb.com/2010/01/making-international-characters-searchable-in-latex-documents/' rel='bookmark' title='Making international characters searchable in LaTeX documents'>Making international characters searchable in LaTeX documents</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://josteinb.com/2009/12/citing-displaying-source-code-in-latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

