<?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>Super Nerdy Cool &#187; Emacs</title>
	<atom:link href="http://blog.nguyenvq.com/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nguyenvq.com</link>
	<description>My (technical) adventures through the professional world...</description>
	<lastBuildDate>Sun, 14 Apr 2013 16:39:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Emacs 24 crashing when launched with Synapse and an emacsclient window is closed</title>
		<link>http://blog.nguyenvq.com/2011/12/09/emacs-24-crashing-when-launched-with-synapse-and-an-emacsclient-window-is-closed/</link>
		<comments>http://blog.nguyenvq.com/2011/12/09/emacs-24-crashing-when-launched-with-synapse-and-an-emacsclient-window-is-closed/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 17:37:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[emacs 24]]></category>
		<category><![CDATA[emacs.sh]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[segmentation fault]]></category>
		<category><![CDATA[synapse]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/2011/12/09/emacs-24-crashing-when-launched-with-synapse-and-an-emacsclient-window-is-closed/</guid>
		<description><![CDATA[I&#8217;m currently using Emacs 24 (pre-release) installed from this repository on Ubuntu 11.04. An error (crash: segmentation fault) that arose after moving from Emacs 23 to Emacs 24 is as follow (could stem from the pre-release repository; might not be the case if I compile from source). I launch emacs via Synapse. I start the...  <a href="http://blog.nguyenvq.com/2011/12/09/emacs-24-crashing-when-launched-with-synapse-and-an-emacsclient-window-is-closed/" class="more-link" title="Read Emacs 24 crashing when launched with Synapse and an emacsclient window is closed">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead">I&#8217;m currently using Emacs 24 (pre-release) installed from <a href="http://emacs.naquadah.org/">this</a> repository on Ubuntu 11.04.  An error (crash: segmentation fault) that arose after moving from Emacs 23 to Emacs 24 is as follow (could stem from the pre-release repository; might not be the case if I compile from source). </p>
<p> I launch <code>emacs</code> via <a href="http://blog.nguyenvq.com/2010/12/02/synapse-to-replace-gnome-do/">Synapse</a>.  I start the daemon server (<code>M-x server-start</code>).  Then, I launch text files from Nautilus via my <code>emacs.sh</code> script: </p>
<pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">sh</span>
<span style="color: #ff4500;">## </span><span style="color: #ff4500;">exec emacsclient --alternate-editor="emacs" -c "$@" ## not using this since I use DeskTop AND set server-on in .emacs...sometimes DeskTop would ask a question when accessing a lock session, and emacs will hang at the question</span>
<span style="color: #ff4500;">## </span><span style="color: #ff4500;">taken from comments section at http://draptik.wordpress.com/2009/10/23/emacsclient-usage-on-a-gnulinux-system/</span>

<span style="color: #ff4500;"># </span><span style="color: #ff4500;">## following doesn't work for emacs 24, only 23</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">emacsclient -e '(gnuserv-done-function)' 2&gt;/dev/null ## suppress the stderr message</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">if [ "$?" -ne "0" ]; then ## http://steve-parker.org/sh/exitcodes.shtml</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">emacs "$@"</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">else</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">emacsclient -c "$@"</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">fi</span>
<span style="color: #00ffff;">exec</span> emacsclient --alternate-editor=<span style="color: #ffa07a;">"emacs"</span> -c <span style="color: #ffa07a;">"$@"</span>
</pre>
<p> When I do <code>C-x #</code> to close the <code>emacsclient</code> window, the entire <code>emacs</code> program crashes.  This does not happen when I launch files from the terminal; it only happens when I launch files using the script (or just the <code>emacsclient</code> command) using Nautilus.  I even launched an unadulterated emacs session via <code>emacs -q</code> and this still happens. </p>
<p> My current solution is to launch my first emacs instance via the default Gnome &#8220;launch application&#8221; (<code>Alt F2</code>). </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/12/09/emacs-24-crashing-when-launched-with-synapse-and-an-emacsclient-window-is-closed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>S5 Reloaded themes with Sigma&#8217;s emacs org-mode method</title>
		<link>http://blog.nguyenvq.com/2011/09/12/s5-reloaded-themes-with-sigmas-emacs-org-mode-method/</link>
		<comments>http://blog.nguyenvq.com/2011/09/12/s5-reloaded-themes-with-sigmas-emacs-org-mode-method/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 12:13:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[S5]]></category>
		<category><![CDATA[S5 presentation]]></category>
		<category><![CDATA[S5 reloaded]]></category>
		<category><![CDATA[slide show]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=1037</guid>
		<description><![CDATA[In the past, I&#8217;ve described the benefits of a slide show based on html. I used to prefer the html5 method over S5, but after some use, I&#8217;ve come to realize that the html5 method (at least the one described here) isn&#8217;t ready for prime time yet. The display of the slides can get screwy....  <a href="http://blog.nguyenvq.com/2011/09/12/s5-reloaded-themes-with-sigmas-emacs-org-mode-method/" class="more-link" title="Read S5 Reloaded themes with Sigma&#8217;s emacs org-mode method">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead"> In the past, I&#8217;ve <a href="http://blog.nguyenvq.com/2011/06/07/non-latex-presentations-using-org-mode-s5-and-html5-slides/">described</a> the benefits of a slide show based on html. I used to prefer the <a href="http://slides.html5rocks.com/">html5</a> method over <a href="http://meyerweb.com/eric/tools/s5/">S5</a>, but after some use, I&#8217;ve come to realize that the html5 method (at least the one described <a href="http://slides.html5rocks.com/">here</a>) isn&#8217;t ready for prime time yet. The display of the slides can get screwy. For example, the current slide might not be centered correctly. Therefore, I&#8217;m going to recommend the S5 system for html slide shows for now. </p>
<p> For use with Emacs org-mode, use <a href="https://github.com/sigma/org-s5/">Sigma&#8217;s</a> method. Why? It is easier to <a href="https://github.com/sigma/org-s5/issues/1">change themes</a> compared to <a href="https://github.com/eschulte/org-S5/issues/">Eric Schulte&#8217;s</a> method (the latter method currently does not support a change in themes I think). In addition, it is compatible with the very good looking <a href="http://www.netzgesta.de/S5/demos.php">S5 Reloaded</a> themes. </p>
<p> To change themes in the original S5 archive and have it work with emacs org-mode, copy <code>ui/default/slides.js</code> to <code>ui/i18n/slides.js</code>. To get S5 Reloaded themes to work, add <code>jquery.js</code> and <code>org-slides.js</code> from Sigma&#8217;s archive (in <code>ui</code>) into S5 Reloaded&#8217;s <code>ui</code> directory. Also, change <code>/default/</code> to the desired location (theme) in <code>S5.org</code> from Sigma&#8217;s archive. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/09/12/s5-reloaded-themes-with-sigmas-emacs-org-mode-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Literature</title>
		<link>http://blog.nguyenvq.com/2011/07/24/research-paper-management-or-library-with-emacs/</link>
		<comments>http://blog.nguyenvq.com/2011/07/24/research-paper-management-or-library-with-emacs/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 22:12:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Researching]]></category>
		<category><![CDATA[academic papers]]></category>
		<category><![CDATA[bib]]></category>
		<category><![CDATA[bibliography]]></category>
		<category><![CDATA[bibtex]]></category>
		<category><![CDATA[bibutils]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[jabref]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[Mendeley]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[references]]></category>
		<category><![CDATA[reftex]]></category>
		<category><![CDATA[research papers]]></category>
		<category><![CDATA[zotero]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=991</guid>
		<description><![CDATA[Despite the availability of softwares such as Mendeley, Zotero, and JabRef, I like to store my papers (pdf files) and citation information (bib files) using a directory stucture, enter notes into a text file (org-mode), view notes and bibliographic information using a single file, cite references in LaTeX from a single bib file, and manage...  <a href="http://blog.nguyenvq.com/2011/07/24/research-paper-management-or-library-with-emacs/" class="more-link" title="Read Literature">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead">Despite the availability of softwares such as <a href="http://www.mendeley.com/">Mendeley</a>, <a href="http://www.zotero.org/">Zotero</a>, and <a href="http://jabref.sourceforge.net/">JabRef</a>, I like to store my papers (<code>pdf</code> files) and citation information (<code>bib</code> files) using a directory stucture, enter notes into a text file (<code>org-mode</code>), view notes and bibliographic information using a single file, cite references in LaTeX from a single <code>bib</code> file, and manage papers in Emacs using <code>dired</code>. I choose to manage my references using the <a href="http://www.bibtex.org/">bib</a> format because it is the de facto standard in academia (at least in my field), and hence, is easily exported from the publisher&#8217;s website. In addition, I write all my papers using LaTeX for which I utilize <code>bibtex</code> whenever a reference is made; if I were to write papers using another program that utilizes a different format for bibliographies, I can easily convert the <code>bib</code> files using <a href="http://bibutils.refbase.org/">bibutils</a>. </p>
<p> This post was originally motivated by <a href="http://tincman.wordpress.com/2011/01/04/research-paper-management-with-emacs-org-mode-and-reftex/">this</a> post which outlines a method to manage papers in emacs and org-mode. However, the workflow did not fit me particularly well, and so I came up with a setup and workflow of my own. I&#8217;ve been using this workflow for the last half a year and never got around to outlining it until the recent org-bibtex <a href="http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40814.html">discussion</a> reminded me to do so. I will first describe my setup and then its usage. I then end with some tips on starting your academic paper library and other thoughts. It is assumed that papers are available in pdf format. All filenames used throughout should not contain spaces, just to be safe. </p>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1">Setup</h3>
<div class="outline-text-3" id="text-1">
<p>The base directory for the research papers I download and their corresponding <code>bib</code> files is <code>~/Documents/Literature</code>. In this base directory, I have a folder <code>scripts</code> for storing scripts that help me manage the files. I also have the files <code>books.bib</code> and <code>software.bib</code> for storing citation information for books and software. The main files, <code>bibliography.bib</code> and <code>literature.org</code> are generated and updated using scripts and hence, are set to be non-writable by me in order to avoid manual editing that will be lost when the next update occurs. </p>
<p> I split my papers into subjects or categories according to directories in the base directory such as <code>./EstimatingEquations</code>, <code>./Survival/</code>, etc. In each of the subject directory, I have a <code>category.org</code> file that assists with structuring the <code>literature.org</code> file. An example of the <code>category.org</code> file: </p>
<pre class="example">* Estimating Equations :EstimatingEquations:

</pre>
<p> Place the following scripts in your script directory, <code>./scripts/</code>. </p>
<p> <code>LitNotes.sh</code>: </p>
<pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">bash</span>

<span style="color: #ff4500;">## </span><span style="color: #ff4500;">template notes.org for a folder with bib.bib file</span>

<span style="color: #00ffff;">if</span> [ -f bib.bib ]
<span style="color: #00ffff;">then</span>
    <span style="color: #00ffff;">if</span> [ -s notes.org ] <span style="color: #ff4500;">## </span><span style="color: #ff4500;">check if filesize is greater than 0 if it exists; FALSE if it does not exsist</span>
    <span style="color: #00ffff;">then</span>
        <span style="color: #b0c4de;">echo</span> <span style="color: #ffa07a;">"./notes.org has content (file size greater than zero.)!"</span> &amp;&amp; <span style="color: #00ffff;">exit</span> 1
    <span style="color: #00ffff;">else</span>
        <span style="color: #ff4500;">## </span><span style="color: #ff4500;">http://stackoverflow.com/questions/5162808/help-with-regex-extracting-text</span>
        <span style="color: #eedd82;">author</span>=$(<span style="color: #fa8072;">sed</span> -n <span style="color: #ffa07a;">'/^[[:blank:]]*author[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}'</span> bib.bib)
        <span style="color: #eedd82;">title</span>=$(<span style="color: #fa8072;">sed</span> -n <span style="color: #ffa07a;">'/^[[:blank:]]*title[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}'</span> bib.bib)
        <span style="color: #eedd82;">year</span>=$(<span style="color: #fa8072;">sed</span> -n <span style="color: #ffa07a;">'/^[[:blank:]]*year[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}'</span> bib.bib)
        <span style="color: #b0c4de;">echo</span> <span style="color: #ffa07a;">"** $author ($year) $title </span>
<span style="color: #ffa07a;">*** Notes</span>
<span style="color: #ffa07a;">"</span> &gt; notes.org
    <span style="color: #00ffff;">fi</span>
<span style="color: #00ffff;">else</span>
    <span style="color: #b0c4de;">echo</span> <span style="color: #ffa07a;">"No bib.bib in current directory."</span> &amp;&amp; <span style="color: #00ffff;">exit</span> 1
<span style="color: #00ffff;">fi</span>

<span style="color: #ff4500;"># </span><span style="color: #ff4500;">## following used on inside each category folder, eg, ./Survival; remember to edit tags in this script</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">for directory in `ls -p | grep "/"`</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">do</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">cd "$directory"</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">##pwd</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">##[ -f notes.org ] &amp;&amp; echo "yes"</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">if [ -f notes.org ];</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">then</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">## http://stackoverflow.com/questions/5162808/help-with-regex-extracting-text</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">author=$(</span><span style="color: #fa8072;">sed</span><span style="color: #ff4500;"> -n '/^[[:blank:]]*author[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}' bib.bib)</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">title=$(</span><span style="color: #fa8072;">sed</span><span style="color: #ff4500;"> -n '/^[[:blank:]]*title[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}' bib.bib)</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">year=$(</span><span style="color: #fa8072;">sed</span><span style="color: #ff4500;"> -n '/^[[:blank:]]*year[[:blank:]]*=[[:blank:]]*{/ {s///; s/}[^}]*$//p}' bib.bib)</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">##author=$(</span><span style="color: #fa8072;">sed</span><span style="color: #ff4500;"> -n '/author *=/{s/^[^{]*{\([^,]*\),.*$/\1/;s/} *$//p}' ./bib.bib) ## does not work well because there could be commas in author</span>
<span style="color: #ff4500;">#         </span><span style="color: #ff4500;">echo "** $author ($year) $title :Survival:</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">*** Notes</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">" ##&gt; notes.org</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">fi</span>
<span style="color: #ff4500;">#     </span><span style="color: #ff4500;">cd ..</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">done</span>
</pre>
<p> <code>LitCreateDir.sh</code>: </p>
<pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">bash</span>

<span style="color: #ff4500;">## </span><span style="color: #ff4500;">arguments are pdf files</span>

<span style="color: #00ffff;">for</span> file<span style="color: #00ffff;"> in</span> <span style="color: #ffa07a;">"$@"</span>
<span style="color: #00ffff;">do</span>
<span style="color: #eedd82;">bn</span>=<span style="color: #fa8072;">`basename "$file"`</span>
<span style="color: #eedd82;">NameNoExt</span>=${<span style="color: #eedd82;">bn</span>%.*} <span style="color: #ff4500;">## </span><span style="color: #ff4500;">no extension</span>
<span style="color: #eedd82;">Ext</span>=${<span style="color: #eedd82;">bn</span>/*./} <span style="color: #ff4500;">## </span><span style="color: #ff4500;">extension http://www.linuxforums.org/forum/programming-scripting/128625-how-get-file-extension-without-dot.html</span>
<span style="color: #00ffff;">if</span> [ <span style="color: #fa8072;">`echo $Ext | tr [:upper:] [:lower:] `</span> = <span style="color: #ffa07a;">"pdf"</span> ] <span style="color: #ff4500;">## </span><span style="color: #ff4500;">only do pdf files</span>
<span style="color: #00ffff;">then</span>
mkdir <span style="color: #ffa07a;">"$NameNoExt"</span>
mv <span style="color: #ffa07a;">"$file"</span> <span style="color: #ffa07a;">"$NameNoExt/"</span>
touch <span style="color: #ffa07a;">"$NameNoExt/bib.bib"</span>
touch <span style="color: #ffa07a;">"$NameNoExt/notes.org"</span>
<span style="color: #00ffff;">if</span> [ -f <span style="color: #ffa07a;">"$NameNoExt.bib"</span> ] <span style="color: #ff4500;">## </span><span style="color: #ff4500;">file exists?</span>
<span style="color: #00ffff;">then</span>
mv -f <span style="color: #ffa07a;">"$NameNoExt.bib"</span> <span style="color: #ffa07a;">"$NameNoExt/bib.bib"</span>
<span style="color: #b0c4de;">cd</span> <span style="color: #ffa07a;">"$NameNoExt"</span>
LitNotes.sh
<span style="color: #b0c4de;">cd</span> ..
<span style="color: #00ffff;">fi</span>
<span style="color: #00ffff;">fi</span>
<span style="color: #00ffff;">done</span>
</pre>
<p> <code>LitUpdate.sh</code>: </p>
<pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">bash</span>

<span style="color: #eedd82;">basedir</span>=<span style="color: #ffa07a;">"$HOME/Documents/Literature"</span>
<span style="color: #eedd82;">bibfile</span>=<span style="color: #ffa07a;">"$basedir/bibliography.bib"</span>
<span style="color: #eedd82;">litfile</span>=<span style="color: #ffa07a;">"$basedir/literature.org"</span>

<span style="color: #ff4500;">## </span><span style="color: #ff4500;">delete old files</span>
<span style="color: #b0c4de;">cd</span> $<span style="color: #eedd82;">basedir</span>
rm -f $<span style="color: #eedd82;">bibfile</span> $<span style="color: #eedd82;">litfile</span>

<span style="color: #ff4500;">## </span><span style="color: #ff4500;">create $bibfile</span>
find ./ -iname <span style="color: #ffa07a;">"*.bib"</span> -print0 | xargs -0 cat &gt; /tmp/bibliography.bib <span style="color: #ff4500;">## </span><span style="color: #ff4500;">-0, some folders have "'" in name; *.bib and not just bib.bib to get books.bib as well</span>
mv /tmp/bibliography.bib ./
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">find ./ -iname "*.bib" -print0 &gt; bibfiles.txt</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">xargs -0 cat &lt; bibfiles.txt &gt; $bibfile</span>
<span style="color: #ff4500;">## </span><span style="color: #ff4500;">books</span>
<span style="color: #ff4500;">##</span><span style="color: #ff4500;">cat books.bib &gt;&gt; $bibfile ## above should already pick up books</span>


<span style="color: #ff4500;">## </span><span style="color: #ff4500;">create $litfile</span>
<span style="color: #b0c4de;">echo</span> <span style="color: #ffa07a;">"#+title: Literature</span>
<span style="color: #ffa07a;">#+author: YOUR NAME HERE</span>
<span style="color: #ffa07a;">#+email: YOUR EMAIL HERE</span>
<span style="color: #ffa07a;">"</span> &gt;&gt; $<span style="color: #eedd82;">litfile</span>
<span style="color: #00ffff;">for</span> directory<span style="color: #00ffff;"> in</span> <span style="color: #fa8072;">`ls -p | grep "/"`</span> <span style="color: #ff4500;">## </span><span style="color: #ff4500;">directories in Literature</span>
<span style="color: #00ffff;">do</span>
<span style="color: #b0c4de;">cd</span> <span style="color: #ffa07a;">"$directory"</span>
<span style="color: #00ffff;">if</span> [ -f category.org ]
<span style="color: #00ffff;">then</span>
cat category.org &gt;&gt; $<span style="color: #eedd82;">litfile</span>
<span style="color: #ff4500;">##</span><span style="color: #ff4500;">find ./ -iname "notes.org" -print0 | xargs -0 cat &gt;&gt; $litfile ## need to add in links to paper, location, bib, notes</span>
<span style="color: #00ffff;">for</span> notes<span style="color: #00ffff;"> in</span> <span style="color: #fa8072;">`find ./ -iname "notes.org"`</span>
<span style="color: #00ffff;">do</span>
<span style="color: #eedd82;">fullpath</span>=<span style="color: #fa8072;">`readlink -f "$notes"`</span>
<span style="color: #ff4500;">##</span><span style="color: #ff4500;">fullpath=`realpath "$notes"` ## http://www.commandlinefu.com/commands/view/7999/get-the-absolute-path-of-a-file?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+Command-line-fu+%28Command-Line-Fu%29&amp;utm_content=Google+Reader</span>
<span style="color: #eedd82;">paperdir</span>=<span style="color: #fa8072;">`dirname "$fullpath"`</span> <span style="color: #ff4500;">## </span><span style="color: #ff4500;">directory name of directory with notes.org</span>
<span style="color: #eedd82;">pdf</span>=<span style="color: #fa8072;">`find "$paperdir" -iname "*.pdf"`</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">cat "$notes" &gt;&gt; $litfile</span>
<span style="color: #ff4500;"># </span><span style="color: #ff4500;">echo "*** [[file:$pdf][paper]] [[file:$paperdir/][location]] [[file:$paperdir/bib.bib][bib]] [[file:$paperdir/notes.org][notes]]" &gt;&gt; $litfile</span>
head -n1 <span style="color: #ffa07a;">"$notes"</span> &gt;&gt; $<span style="color: #eedd82;">litfile</span>
<span style="color: #b0c4de;">echo</span> <span style="color: #ffa07a;">"*** [[file:$pdf][paper]] [[file:$paperdir/][location]] [[file:$paperdir/bib.bib][bib]] [[file:$paperdir/notes.org][notes]]"</span> &gt;&gt; $<span style="color: #eedd82;">litfile</span>
sed <span style="color: #ffa07a;">'1 d'</span> <span style="color: #ffa07a;">"$notes"</span> &gt;&gt; $<span style="color: #eedd82;">litfile</span>
<span style="color: #00ffff;">done</span>
<span style="color: #00ffff;">fi</span>
<span style="color: #b0c4de;">cd</span> ..
<span style="color: #00ffff;">done</span>

<span style="color: #ff4500;">## </span><span style="color: #ff4500;">make file read-only, so I have to manually go to the individual files to edit</span>
chmod <span style="color: #eedd82;">ugo</span>=r $<span style="color: #eedd82;">litfile</span> $<span style="color: #eedd82;">bibfile</span>
</pre>
<p> Place the following in your emacs init file: </p>
<pre class="example">;; Literature
(defun dired-literature-create-directory-from-pdf ()
(interactive)
(save-window-excursion
(dired-do-async-shell-command
"$HOME/Documents/Literature/scripts/LitCreateDir.sh" current-prefix-arg
(dired-get-marked-files t current-prefix-arg))))
(define-key dired-mode-map (kbd "s-l d") 'dired-literature-create-directory-from-pdf)

(defun literature-update ()
(interactive)
(shell-command "LitUpdate.sh")
)
(global-set-key (kbd "s-l u") 'literature-update)
</pre>
</p></div>
</p></div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2">Usage</h3>
<div class="outline-text-3" id="text-2">
<p>I recommend the pdf file be named <code>AuthorYearTitle.pdf</code> to be consistent across all papers. The <code>Title</code> of course should be short and descriptive. Whenever I download a pdf paper, I make it MANDATORY that I also download the corresponding <code>bib</code> file (too many times did I have to cite a paper I thought I&#8217;d never cite). Nearly all publishers can export to <code>bib</code>, including <a href="http://www.jstor.org/">JSTOR</a>. If the publishing site doesn&#8217;t have this feature, I recommend googling the article in <a href="http://scholar.google.com/">Google Scholar</a> and exporting the <code>bib</code> file from the search results via &#8220;Export to BibTeX&#8221; (needs to be turned on in the Google Scholar settings); if this too isn&#8217;t available, then I will write my own <code>bib</code> file manually. Name this file <code>AuthorYearTitle.bib</code>, identically the same as the pdf file except the file extension (this is crucial for the scripts to work). I usually find myself visiting the downloaded <code>bib</code> file and editing it according to my preference. For example, I don&#8217;t like to have leading spaces in each line and I want each tag (e.g., journal) to be encapsulated by curly braces and end with a comma, even if it is the last tag. Also, make sure that there is at least one empty line at the end of the <code>bib</code> file; more on this in the &#8220;Other Thoughts&#8221; section. </p>
<p> Suppose I downloaded these files in <code>/tmp</code>. In emacs, I will use dired to cut and paste these two files into the subject directory that it belongs to; for example, <code>./Survival</code>. In dired, I will move the cursor to the pdf file and hit <code>s-l d</code> (d for directory); for multiple papers downloaded and moved at the same time, just mark the pdf files first before running <code>s-l d</code>. This will create a directory <code>AuthorYearTitle</code> in <code>./Survival</code> for each marked paper, move the corresponding pdf and bib files into the newly created directory, and generate a templated <code>notes.org</code> whose content will be generated from the tags in the <code>bib</code> file: </p>
<pre class="example">** Author (Year) Title
*** Notes

</pre>
<p> Things learned and notes regarding the content of the paper is meant to be typed into <code>notes.org</code> file so that I can review my thoughts later (and not have to necessarily re-read a paper to see what I learned). </p>
<p> Why do I store each paper in its own directory? I want the paper, <code>bib</code> file, and my notes to be self-contained in a single entity, and a directory is the best way to achieve this goal. That way, I can move (to a new category?) or copy (send to a colleague?) the paper with all the information intact. </p>
<p> After downloading new papers or moving papers around into a different (new?) categroy, running <code>s-l u</code> updates my <code>bibliography.bib</code> and <code>literature.org</code> file. All <code>bib</code> files (papers, books, and software) are concatenated into a single <code>bibliography.bib</code> file so that a single <code>\bibliography{$HOME/Documents/Literature/bibliography.bib}</code> can be inserted in all my LaTeX files that make use of references. All <code>category.org</code> and <code>notes.org</code> files are concatenated into a single <code>literature.org</code> file to create a single &#8220;library&#8221; where I can view all the available information; the paper, location, bib, and notes file can also be opened using <code>C-c o</code> (org-mode link). Since it is a text file, all the power of emacs (and other tools) can be used on this file: ordinary searches, regex searches, etc. This way, I can search my thoughts (via notes) to find or trace ideas back to a paper. Here is a snippet of what a generated <code>literature.org</code> file looks like: </p>
<pre class="example">#+title: Literature
#+author: MY NAME
#+email: MY EMAIL

* Estimating Equations :EstimatingEquations:
** White, Halbert (1982) Maximum Likelihood Estimation of Misspecified Models :EstimatingEquations:
*** [[file:/home/vinh/Documents/Literature/EstimatingEquations/White1982MLEMisspecifiedModels/White1982MLEMisspecifiedModels.pdf][paper]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/White1982MLEMisspecifiedModels/][location]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/White1982MLEMisspecifiedModels/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/White1982MLEMisspecifiedModels/notes.org][notes]]
*** Notes

** Whitney K. Newey and Daniel McFadden (1994) Chapter 36 Large sample estimation and hypothesis testing
*** [[file:/home/vinh/Documents/Literature/EstimatingEquations/NeweyMcFadden1994LargeSampleEstimationTesting/NeweyMcFadden1994LargeSampleEstimationTesting.pdf][paper]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/NeweyMcFadden1994LargeSampleEstimationTesting/][location]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/NeweyMcFadden1994LargeSampleEstimationTesting/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/NeweyMcFadden1994LargeSampleEstimationTesting/notes.org][notes]]
*** Notes

** Cox, D. R. (1993) Unbiased Estimating Equations Derived from Statistics that are Functions of a Parameter
*** [[file:/home/vinh/Documents/Literature/EstimatingEquations/Cox1993UnbiasedEstEqDerived/Cox1993UnbiasedEstEqDerived.pdf][paper]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/Cox1993UnbiasedEstEqDerived/][location]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/Cox1993UnbiasedEstEqDerived/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/EstimatingEquations/Cox1993UnbiasedEstEqDerived/notes.org][notes]]
*** Notes

...

* Genetics :Genetics:
** French, Benjamin and Lumley, Thomas and Monks, Stephanie A. and Rice, Kenneth M. and Hindorff, Lucia A. and Reiner, Alexander P. and Psaty, Bruce M. (2006) Simple estimates of haplotype relative risks in case-control data
*** [[file:/home/vinh/Documents/Literature/Genetics/FrenchLumley+Others2006HaplotypesRelativeRisk/FrenchLumley+Others2006HaplotypesRelativeRisk.pdf][paper]] [[file:/home/vinh/Documents/Literature/Genetics/FrenchLumley+Others2006HaplotypesRelativeRisk/][location]] [[file:/home/vinh/Documents/Literature/Genetics/FrenchLumley+Others2006HaplotypesRelativeRisk/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/Genetics/FrenchLumley+Others2006HaplotypesRelativeRisk/notes.org][notes]]
*** Notes

** Follmann, Dean and Proschan, Michael and Leifer, Eric (2003) Multiple Outputation: Inference for Complex Clustered Data by Averaging Analyses from Independent Data
*** [[file:/home/vinh/Documents/Literature/Genetics/FollmanProschanLeifer2003MultipleOutputation/FollmanProschanLeifer2003MultipleOutputation.pdf][paper]] [[file:/home/vinh/Documents/Literature/Genetics/FollmanProschanLeifer2003MultipleOutputation/][location]] [[file:/home/vinh/Documents/Literature/Genetics/FollmanProschanLeifer2003MultipleOutputation/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/Genetics/FollmanProschanLeifer2003MultipleOutputation/notes.org][notes]]
*** Notes

** Lin, D.Y. and Zeng, D. and Millikan, R. (2005) Maximum likelihood estimation of haplotype effects and haplotype-environment interactions in association studies
*** [[file:/home/vinh/Documents/Literature/Genetics/LinZengMillikan2005MLEHaplotype/LinZengMillikan2005MLEHaplotype.pdf][paper]] [[file:/home/vinh/Documents/Literature/Genetics/LinZengMillikan2005MLEHaplotype/][location]] [[file:/home/vinh/Documents/Literature/Genetics/LinZengMillikan2005MLEHaplotype/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/Genetics/LinZengMillikan2005MLEHaplotype/notes.org][notes]]
*** Notes

** Lin, DY and Zeng, D. (2006) Likelihood-based inference on haplotype effects in genetic association studies
*** [[file:/home/vinh/Documents/Literature/Genetics/LinZeng2006LikelihoodInferenceHaplotype/LinZeng2006LikelihoodInferenceHaplotype.pdf][paper]] [[file:/home/vinh/Documents/Literature/Genetics/LinZeng2006LikelihoodInferenceHaplotype/][location]] [[file:/home/vinh/Documents/Literature/Genetics/LinZeng2006LikelihoodInferenceHaplotype/bib.bib][bib]] [[file:/home/vinh/Documents/Literature/Genetics/LinZeng2006LikelihoodInferenceHaplotype/notes.org][notes]]
*** Notes

...

</pre>
<p> Note that the update process can take seconds or more due to the concatenation. My library is ever-growing so it will only get longer and longer to update. I&#8217;m not sure if I can ever speed up this process (let me know if you have ideas). </p>
<p> After running the update process, <code>reftex-reset-mode</code> should be run in an opened LaTeX file if you want to make use of the most current information with RefTeX. </p>
<p> I make use of emacs&#8217;s bookmark capabalities (<code>C-x r b</code>) to visit these files easily in emacs. </p>
</p></div>
</p></div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3">Getting started</h3>
<div class="outline-text-3" id="text-3">
<p>Most researchers have their downloaded pdf files in one location or multiple locations (category). To get started, I recommend spending time to rename the files according to <code>AuthorYearTitle.pdf</code>, and downloading or creating a separate <code>bib</code> file for each paper. Then place the files into their category directories (create <code>category.org</code> as well). In emacs dired, mark all the pdf files in each category, run <code>s-l d</code> to generate a self-contained directory for each paper. After this is done on all the categories, run <code>s-l u</code> to update. The file <code>bibliography.bib</code> can now be used in your LaTeX documents. The file <code>literature.org</code> can be now be used as an all in one library. </p>
</p></div>
</p></div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4">Other thoughts</h3>
<div class="outline-text-3" id="text-4">
<p>Each <code>bib</code> file should have at least one empty line at the end of the file or things may go wrong in the <code>bibliography.bib</code> file; this paper is concatenated from multiple files, and multiple lines could be joined into one line if the newline character isn&#8217;t present at the end of the file. </p>
<p> I also have a <code>bibliography.tex</code> file to generate a pdf file with all my papers: </p>
<pre class="example">\documentclass{article}
\usepackage{fullpage}
\usepackage{natbib}

\begin{document}

\cite{*}
\bibliographystyle{apa}
\bibliography{bibliography}

\end{document}
</pre>
<p> One thing I would like to be able to do is edit the literature.org file (notes portion) directly and have the changes reflected in the individual <code>notes.org</code> files. I haven&#8217;t thought of a process to do this well. It would be nice to view multiple files in a single buffer as if the buffer is showing a single file so that when I edit a portion of the buffer, it actually is a different file depending on its location. </p>
<p> I&#8217;m not sure if anyone will find my workflow useful, but I just wanted to document it for the masses. </p>
</p></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/07/24/research-paper-management-or-library-with-emacs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ignore errors when executing a command in emacs with condition-case</title>
		<link>http://blog.nguyenvq.com/2011/06/30/ignore-errors-when-executing-a-command-in-emacs-with-condition-case/</link>
		<comments>http://blog.nguyenvq.com/2011/06/30/ignore-errors-when-executing-a-command-in-emacs-with-condition-case/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 21:21:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[condition-case]]></category>
		<category><![CDATA[ignore error]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=962</guid>
		<description><![CDATA[Suppose you want to execute a command in your emacs init file, but this command sometimes return an error. For example, you ask emacs to open a file for you, but the file doesn&#8217;t exist. When an error occurs, the rest of the init will not be loaded. Once can make use of the condition-case...  <a href="http://blog.nguyenvq.com/2011/06/30/ignore-errors-when-executing-a-command-in-emacs-with-condition-case/" class="more-link" title="Read Ignore errors when executing a command in emacs with condition-case">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead"> Suppose you want to execute a command in your emacs init file, but this command sometimes return an error. For example, you ask emacs to open a file for you, but the file doesn&#8217;t exist. When an error occurs, the rest of the init will not be loaded. Once can make use of the <code>condition-case</code> command to ignore the error. The following is an example: </p>
<pre class="example">(condition-case nil
(wg-load "~/.emacs.d/workgroups-save") ;; ignore errors from this command
(error nil))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/06/30/ignore-errors-when-executing-a-command-in-emacs-with-condition-case/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Some custom emacs keybindings for LaTeX to assist in the writing process</title>
		<link>http://blog.nguyenvq.com/2011/06/29/some-custom-emacs-keybindings-for-latex-to-assist-in-the-writing-process/</link>
		<comments>http://blog.nguyenvq.com/2011/06/29/some-custom-emacs-keybindings-for-latex-to-assist-in-the-writing-process/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 03:52:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[keybindings]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=955</guid>
		<description><![CDATA[Here are some habits I think will assist in the writing of LaTeX documents: Always encapsulate your superscripts and subscripts with curly braces, even if they consist only of 1 characters. For example, it should x_{1} rather than x_1. The reason is that lot&#8217;s of time, I go back to changing my subscripts, and I...  <a href="http://blog.nguyenvq.com/2011/06/29/some-custom-emacs-keybindings-for-latex-to-assist-in-the-writing-process/" class="more-link" title="Read Some custom emacs keybindings for LaTeX to assist in the writing process">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead">Here are some habits I think will assist in the writing of LaTeX documents: </p>
<ol class="org-ol">
<li>Always encapsulate your superscripts and subscripts with curly braces, even if they consist only of 1 characters. For example, it should <code>x_{1}</code> rather than <code>x_1</code>. The reason is that lot&#8217;s of time, I go back to changing my subscripts, and I often use a command like <code>replace-string</code> in emacs to help do it for the entire document. If I change the subscript from 1 character to multiple characters, thing gets messed up. For example, <code>x_1</code> to <code>x_i1</code> where it should really be <code>x_{i1}</code>. Using curly braces just help prevent things from going wrong and having to go back to the errors. </li>
<li>As mentioned on <a href="http://blog.nguyenvq.com/2011/06/13/version-control-and-collaborating-with-latex-files/">this</a> post, it is best to keep each sentence on its own line to facilitate version controlling the document. </li>
</ol>
<p> To help with these two tasks, I&#8217;ve binded my &#8220;.&#8221;, &#8220;\^&#8221;, and &#8220;_&#8221; keys to smart functions that will do what I want. Pressing the keys again will go back to the plain character. </p>
<pre class="example">;; following for latex, adapted from ess-smart-underscore
;; can also be implemented using sequential command http://www.emacswiki.org/emacs/SequentialCommand
(defun tex-smart-underscore ()
 "Smart \"_\" key: insert \"_{}\".
If the underscore key is pressed a second time, \"_{}\" is removed and replaced by the underscore."
 (interactive)
 (let ((assign-len (length "_{")))
 (if (and
 (&gt;= (point) (+ assign-len (point-min))) ;check that we can move back
 (save-excursion
 (backward-char assign-len)
 (looking-at "_{}")))
 ;; If we are currently looking at ess-S-assign, replace it with _
 (progn
 (forward-char)
 (delete-backward-char (+ 1 assign-len))
 (insert "_"))
 (delete-horizontal-space)
 (insert "_{}")
 (backward-char))))

(defun tex-smart-caret ()
 "Smart \"\^\" key: insert \"\^{}\".
If the caret key is pressed a second time, \"\^{}\" is removed and replaced by the caret."
 (interactive)
 (let ((assign-len (length "\^{")))
 (if (and
 (&gt;= (point) (+ assign-len (point-min))) ;check that we can move back
 (save-excursion
 (backward-char assign-len)
 (looking-at "\\\^{}"))) ;; looking-at reads regexp, so need to escape the caret character
 ;; If we are currently looking at ess-S-assign, replace it with \^
 (progn
 (forward-char)
 (delete-backward-char (+ 1 assign-len))
 (insert "\^"))
 (delete-horizontal-space)
 (insert "\^{}")
 (backward-char))))


(defun tex-smart-period ()
 "Smart \".\" key: insert \". \n\".
If the period key is pressed a second time, \". \n\" is removed and replaced by the period."
 (interactive)
 (let ((assign-len (length ". %%\n")))
 (if (and
 (&gt;= (point) (+ assign-len (point-min))) ;check that we can move back
 (save-excursion
 (backward-char assign-len)
 (looking-at "\\. %%")))
 ;; If we are currently looking at ess-S-assign, replace it with _
 (progn
 (delete-backward-char assign-len)
 (insert "."))
 (delete-horizontal-space)
 (insert ". %%\n"))))


;; http://stackoverflow.com/questions/5500035/set-custom-keybinding-for-specific-emacs-mode
;; eval-after-load didn't fix this for me
;; http://www.emacswiki.org/emacs/LaTeX
(add-hook 'LaTeX-mode-hook (lambda ()
 (define-key LaTeX-mode-map (kbd "_") 'tex-smart-underscore)
 (define-key LaTeX-mode-map (kbd "\^") 'tex-smart-caret)
 (define-key LaTeX-mode-map (kbd ".") 'tex-smart-period)
 )
 )
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/06/29/some-custom-emacs-keybindings-for-latex-to-assist-in-the-writing-process/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Convert a string to emacs regexp</title>
		<link>http://blog.nguyenvq.com/2011/06/29/convert-a-string-to-emacs-regexp/</link>
		<comments>http://blog.nguyenvq.com/2011/06/29/convert-a-string-to-emacs-regexp/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 03:21:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[regexp-quote]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=953</guid>
		<description><![CDATA[Suppose you want to convert a string (e.g., &#8220;\^{}&#8221;) to an emacs regexp representation. Then do evaluate the lisp code: (regexp-quote "\^{}"), which would yield \\\^{}. Remember, you can evaluate elisp with M-:.]]></description>
				<content:encoded><![CDATA[<p class="lead"> Suppose you want to convert a string (e.g., &#8220;\^{}&#8221;) to an emacs regexp representation. Then do evaluate the lisp code: <code>(regexp-quote "\^{}")</code>, which would yield <code>\\\^{}</code>. Remember, you can evaluate elisp with <code>M-:</code>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/06/29/convert-a-string-to-emacs-regexp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Byobu, an enhanced screen</title>
		<link>http://blog.nguyenvq.com/2011/06/09/byobu-an-enhanced-screen/</link>
		<comments>http://blog.nguyenvq.com/2011/06/09/byobu-an-enhanced-screen/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 23:30:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[byobu]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[keybindings]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=943</guid>
		<description><![CDATA[I use screen on a daily basis. I recently discovered byobu, an enhanced add-on for screen that makes it even more customizable. A screencast can be found here. After reading some descriptions of byobu here and here, I re-discovered screen&#8217;s ability to split screens. I&#8217;ll probably begin to use this feature. Not sure if I&#8217;ll...  <a href="http://blog.nguyenvq.com/2011/06/09/byobu-an-enhanced-screen/" class="more-link" title="Read Byobu, an enhanced screen">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead"> I <a href="http://blog.nguyenvq.com/tag/screen/">use</a> <a href="http://www.gnu.org/software/screen/">screen</a> on a daily basis. I recently discovered <a href="https://launchpad.net/byobu">byobu</a>, an enhanced add-on for screen that makes it even more customizable. A screencast can be found <a href="http://blog.dustinkirkland.com/2011/05/byobu-video-from-uds-o-lightning-talks.html">here</a>. After reading some descriptions of <code>byobu</code> <a href="http://kmandla.wordpress.com/2010/01/03/byobu-a-shortcut-to-a-prettier-screen/">here</a> and <a href="http://linuxaria.com/howto/screen-byobu">here</a>, I re-discovered screen&#8217;s ability to split screens. I&#8217;ll probably begin to use this feature. Not sure if I&#8217;ll need to use <code>byobu</code>. I do like the row on the bottom describing the system resources. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/06/09/byobu-an-enhanced-screen/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Non-LaTeX presentations using org-mode &#8211; S5 and HTML5 slides</title>
		<link>http://blog.nguyenvq.com/2011/06/07/non-latex-presentations-using-org-mode-s5-and-html5-slides/</link>
		<comments>http://blog.nguyenvq.com/2011/06/07/non-latex-presentations-using-org-mode-s5-and-html5-slides/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 00:50:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Beamer]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[S5]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=937</guid>
		<description><![CDATA[I recently had frustrations with presentations written using MS Powerpoint; I&#8217;m not even going to mention KeyNote as it is only available on a Mac. LibreOffice is my WYSIWYG editor on my Linux machine for writing quick and nicely formatted content. I also have MS Office installed on my machine using WINE. I sometimes use...  <a href="http://blog.nguyenvq.com/2011/06/07/non-latex-presentations-using-org-mode-s5-and-html5-slides/" class="more-link" title="Read Non-LaTeX presentations using org-mode &#8211; S5 and HTML5 slides">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead"> I recently had frustrations with presentations written using MS Powerpoint; I&#8217;m not even going to mention KeyNote as it is only available on a Mac. <a href="http://www.libreoffice.org/">LibreOffice</a> is my WYSIWYG editor on my Linux machine for writing quick and nicely formatted content. I also have MS Office <a href="http://blog.nguyenvq.com/2010/07/23/705/">installed</a> on my machine using <a href="http://www.winehq.org/">WINE</a>. I sometimes use Google Docs for presentation when I have to collaborate. Most of the times, viewing MS-generated files on LibreOffice suffices. When it doesn&#8217;t work well, I opt for MS Office. However, I recently had to open a powerpoint presentation with an audio link. It didn&#8217;t play on LibreOffice and it didn&#8217;t play on my WINE MS Office. I started thinking about a possible route for presentation files that are self-contained and cross-platform. PDF comes to mind first, but to do so would mean I have to use Beamer to generate the slides or to use Adobe Acrobat to create the slides. I don&#8217;t want to do either as I&#8217;m referring to the scenario of creating quick slides. </p>
<p> HTML came to my mind next. I recalled <a href="http://meyerweb.com/eric/tools/s5/">S5</a>. I remember <a href="http://www.hodique.info/blog/2009/11/14/s5_presentation_from_org-mode">this</a> post which outlines how one could export to S5 using org-mode. I tried it out finally and things work nicely. <a href="http://orgmode.org/worg/org-tutorials/non-beamer-presentations.html">This</a> tutorial also mentions an alternative method to generate S5 presentations in org-mode based on the <code>org-export-as-s5</code> function. Hopefully it will be integrated in the MASTER branch of org-mode soon. To embed audio or video, just paste the html code an html chunk, linking the file multimedia file in the current directory. Now the directory could be transferred to any computer and viewed. </p>
<p> I also stumbled on <a href="https://github.com/kinjo/org-html5presentation.el/">this</a> link, which allows me to export org files to HTML5 slides. I think the latest file is <a href="https://gist.github.com/509761">here</a>, with instructions on how to set up in the comments. </p>
<p> With the S5 and HTML5 slides exporting methods in org-mode, now I can make cross-platform presentations very easily using org-mode. I will probably use the HTML5 method as it doesn&#8217;t come with any dependencies like the <code>ui</code> directory from S5. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/06/07/non-latex-presentations-using-org-mode-s5-and-html5-slides/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>emacs keybindings in xpdf and xdvi</title>
		<link>http://blog.nguyenvq.com/2011/05/10/emacs-keybindings-in-xpdf-and-xdvi/</link>
		<comments>http://blog.nguyenvq.com/2011/05/10/emacs-keybindings-in-xpdf-and-xdvi/#comments</comments>
		<pubDate>Tue, 10 May 2011 21:52:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[djview]]></category>
		<category><![CDATA[djvu]]></category>
		<category><![CDATA[dvi]]></category>
		<category><![CDATA[ghostview]]></category>
		<category><![CDATA[keybindings]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[postscript]]></category>
		<category><![CDATA[xdvi]]></category>
		<category><![CDATA[xpdf]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=919</guid>
		<description><![CDATA[I&#8217;ve been using xpdf and xdvi for reading documents I&#8217;ve downloaded or my LaTeX-generated documents on the laptop more and more these days due to their speed. The one thing I require (desire) in all programs I use on a day to day basis, especially when I have to navigate the file, is to have...  <a href="http://blog.nguyenvq.com/2011/05/10/emacs-keybindings-in-xpdf-and-xdvi/" class="more-link" title="Read emacs keybindings in xpdf and xdvi">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead">I&#8217;ve been using xpdf and xdvi for reading documents I&#8217;ve downloaded or my LaTeX-generated documents on the laptop more and more these days due to their speed. The one thing I require (desire) in all programs I use on a day to day basis, especially when I have to navigate the file, is to have emacs keybindings. </p>
<p> To do so for the two readers, first, add the following to <code>~/.Xresources</code>: </p>
<pre class="src src-sh">! look<span style="color: #00ffff;"> in</span> man xdvi
xdvi.mainTranslations: <span style="color: #ff4500;">#</span><span style="color: #ff4500;">override </span>
Ctrlv: down-or-next()n
Altv: up-or-previous()n
Alt Shift &lt;: goto-page(1)n
Alt Shift &gt;: goto-page()n
Ctrlf: right(0.015)n
Ctrlb: left(0.015)n
Ctrln: down(0.015)n
Ctrlp: up(0.015)n
l: right(0.015)n
h: left(0.015)n
j: down(0.015)n
k: up(0.015)n
Ctrls: find()n
xdvi*geometry: 1350x700
xdvi*shrinkFactor: 4

! look<span style="color: #00ffff;"> in</span> man xpdf and xpdfrc; ~/.xpdfrc
xpdf*geometry: 1350x700
xpdf*initialZoom: width
</pre>
<p> Also, create and add the following to <code>~/.xpdfrc</code>: </p>
<pre class="src src-sh">initialZoom width
continuousView yes
<span style="color: #b0c4de;">bind</span> ctrl-v any pageDown
<span style="color: #b0c4de;">bind</span> alt-v any pageUp
<span style="color: #b0c4de;">bind</span> alt-shift-&lt; any gotoPage(1)
<span style="color: #b0c4de;">bind</span> alt-shift-&gt; any gotoLastPage
<span style="color: #b0c4de;">bind</span> ctrl-n any scrollDown(16)
<span style="color: #b0c4de;">bind</span> ctrl-p any scrollUp(16)
<span style="color: #b0c4de;">bind</span> ctrl-f any scrollRight(16)
<span style="color: #b0c4de;">bind</span> ctrl-b any scrollLeft(16)
<span style="color: #b0c4de;">bind</span> h any scrollLeft(16)
<span style="color: #b0c4de;">bind</span> l any scrollRight(16)
<span style="color: #b0c4de;">bind</span> k any scrollUp(16)
<span style="color: #b0c4de;">bind</span> j any scrollDown(16)
<span style="color: #b0c4de;">bind</span> ctrl-s any find
</pre>
<p> Now I can at least navigate the file with emacs keybindings. </p>
<p> I would also like to get this to work on ghostview (for postscript files) or djview (for djvu files), but have yet to find out how to do so on these programs (or found programs for these formats that allow custom keybindings). I&#8217;ve <a href="http://blog.nguyenvq.com/2011/02/15/emacs-as-my-default-pdf-viewer/">written</a> about using emacs&#8217; doc-view to view all my files, but it can be sub-optimal: </p>
<ul class="org-ul">
<li>the conversion process on large files can take a long time, </li>
<li>no &#8220;continuous&#8221; view mode, </li>
<li>searching the text does not highlight the text, </li>
<li>and the file doesn&#8217;t update when the dvi or pdf file is updated (or have a keybinding to update) for use with LaTeX (editing and updating files). UPDsATE: actually, you can refresh using the <code>r</code> keybinding; it works quite fast and stays on the same page you are on. </li>
</ul>
<p> Please do let me know if you know how to make custom keybindings on ghostview or djview (or similar, fast programs). Also let me know if I am not aware of any features in doc-view that would make my life easier. Thanks! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/05/10/emacs-keybindings-in-xpdf-and-xdvi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>escreen instead of elscreen for screen-like features in emacs</title>
		<link>http://blog.nguyenvq.com/2011/03/07/escreen-instead-of-elscreen-for-screen-like-features-in-emacs/</link>
		<comments>http://blog.nguyenvq.com/2011/03/07/escreen-instead-of-elscreen-for-screen-like-features-in-emacs/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 22:51:00 +0000</pubDate>
		<dc:creator>Vinh Nguyen</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[elscreen]]></category>
		<category><![CDATA[emacsclient]]></category>
		<category><![CDATA[escreen]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Rnw]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[sweave]]></category>

		<guid isPermaLink="false">http://blog.nguyenvq.com/?p=885</guid>
		<description><![CDATA[I&#8217;ve been using elscreen for screen-like features in emacs the last couple of years. However, I have a few complaints. Elscreen has issues when used with emacsclient -c: a new frame might not be created from the -c argument, which messes up my current screen in emacs, and the &#8220;Opening Server Files Always in a...  <a href="http://blog.nguyenvq.com/2011/03/07/escreen-instead-of-elscreen-for-screen-like-features-in-emacs/" class="more-link" title="Read escreen instead of elscreen for screen-like features in emacs">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p class="lead">I&#8217;ve been using <a href="http://www.morishima.net/~naoto/software/elscreen/">elscreen</a> for <a href="http://www.gnu.org/software/screen/">screen</a>-like features in emacs the last couple of years. However, I have a few complaints. Elscreen has issues when used with <code>emacsclient -c</code>: a new frame might not be created from the <code>-c</code> argument, which messes up my current screen in emacs, and the &#8220;Opening Server Files Always in a New Frame&#8221; tip on <a href="http://www.emacswiki.org/emacs/EmacsClient">this</a> did not resolve this issue perfectly with elscreen. Also, when used with emacs&#8217; <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Emacs-Sessions.html">Desktop</a> mode, I get an error when launching emacs with an <code>Rnw</code> file (Rweave, or Sweave) is in the file list; the launch actually does not load all files, and I have to exit and delete my desktop file (which I&#8217;ll lose the list of files). </p>
<p> I discovered <a href="http://www.splode.com/~friedman/software/emacs-lisp/src/escreen.el">escreen</a> from <a href="http://blog.tapoueh.org/news.dim.html# Escreen integration">this</a> post a long time ago, and thought escreen was pretty lightweight and worked pretty well. However, I never switched to it because it didn&#8217;t have &#8220;tabs&#8221; for me to know which screen I was at. I didn&#8217;t realize the very same post had customizations that would show which screen you are at. I&#8217;ve copied his customizations, and added a few more of my own, which I&#8217;ll list here: </p>
<pre class="example">;; escreen is simpler than elscreen...but elscreen spawns new 0-9 set of screens for a new frame whereas escreen does not
;; it is better than elscreen because: elscreen has issues when using with emacsclient -c (does not always create new frame, messes up existing frame); in escreen, each screen has its own ring of recently visited files (good!)
;; http://blog.tapoueh.org/news.dim.html#%20Escreen%20integration
;; http://www.splode.com/~friedman/software/emacs-lisp/#ui
(load "escreen")
(escreen-install)
(setq escreen-prefix-char "\C-z") ;; http://www.macs.hw.ac.uk/~hwloidl/cool-el.html
(global-set-key escreen-prefix-char 'escreen-prefix)
;; add C-\ l to list screens with emphase for current one
(defun escreen-get-active-screen-numbers-with-emphasis ()
 "what the name says"
 (interactive)
 (let ((escreens (escreen-get-active-screen-numbers))
 (emphased ""))

 (dolist (s escreens)
 (setq emphased
 (concat emphased (if (= escreen-current-screen-number s)
 (propertize (number-to-string s)
 ;;'face 'custom-variable-tag) " ")
 'face 'info-title-3)
 ;;'face 'font-lock-warning-face)
 ;;'face 'secondary-selection)
 (number-to-string s))
 " ")))
 (message "escreen: active screens: %s" emphased)))

(global-set-key (kbd "C-\\ l") 'escreen-get-active-screen-numbers-with-emphasis)

(defun escreen-goto-last-screen-dim ()
 (interactive)
 (escreen-goto-last-screen)
 (escreen-get-active-screen-numbers-with-emphasis))

(defun escreen-goto-prev-screen-dim (&amp;optional n)
 (interactive "p")
 (escreen-goto-prev-screen n)
 (escreen-get-active-screen-numbers-with-emphasis))

(defun escreen-goto-next-screen-dim (&amp;optional n)
 (interactive "p")
 (escreen-goto-next-screen n)
 (escreen-get-active-screen-numbers-with-emphasis))

(define-key escreen-map escreen-prefix-char 'escreen-goto-last-screen-dim)

(defun escreen-create-screen-dim ()
 (interactive)
 (escreen-create-screen)
 (escreen-get-active-screen-numbers-with-emphasis))

(defun escreen-kill-screen-dim ()
 (interactive)
 (escreen-kill-screen)
 (escreen-get-active-screen-numbers-with-emphasis))

(add-hook 'escreen-goto-screen-hook 'escreen-get-active-screen-numbers-with-emphasis)

(define-key escreen-map "c" 'escreen-create-screen-dim)
(define-key escreen-map "k" 'escreen-kill-screen-dim)

;; (global-set-key (kbd "C-]") 'escreen-goto-next-screen)
;; (keyboard-translate ?\C-[ ?\H-[)
;; (global-set-key (kbd "H-[") 'escreen-goto-prev-screen)
(global-set-key (kbd "C-]") 'escreen-goto-next-screen-dim)
(keyboard-translate ?\C-[ ?\H-[)
(global-set-key (kbd "H-[") 'escreen-goto-prev-screen-dim)
</pre>
<p> Whenever I create/kill/visit a screen, the minibuffer will always show the list of screens available, with emphasis on the current screen. I like escreen because it does not have the issues I listed before with elscreen. Also, in escreen, each screen has its own ring of recently visited files, so that if I move to a different screen and edit a buffer, move back to my original screen, kill the buffer, the recent buffer from the other screen will not be the default screen on this current screen. </p>
<p> I like escreen! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nguyenvq.com/2011/03/07/escreen-instead-of-elscreen-for-screen-like-features-in-emacs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using n/a (User agent is rejected)

 Served from: blog.nguyenvq.com @ 2013-05-20 09:17:53 by W3 Total Cache -->