If you ever wanted to simple animations of your graphs or pictures in your LaTeX paper then the animate package is the way to go. The documentation and examples are good to get you started.
Postings on living in an Emacs world. Posts will be mostly on using Emacs, related functions and tools.
Ads by Google
Sunday, June 15, 2008
Wednesday, June 11, 2008
A quick way to open files in Emacs
Emacs users when interacting with the shell have a faster method to open files compared to other editors. Most editors will provide a shell escape through which a listing of a directory can be got; or a find command executed.
That's it.
You still need to highlight the interested file, copy into your "open file" dialog and then open the file. Well, Emacs offers the same feature too and more.
If your point is positioned at the start of the file name /tmp/foo, then M-x ffap which stands "find file at point" opens the file. As usual the excellent documentation of ffap gives you other options. Apart from the name, the way the file is opened is simply intuitive without any fuss. In fact, the documentation lists other options to ffap that might useful for mouse users.
That's it.
You still need to highlight the interested file, copy into your "open file" dialog and then open the file. Well, Emacs offers the same feature too and more.
If your point is positioned at the start of the file name /tmp/foo, then M-x ffap which stands "find file at point" opens the file. As usual the excellent documentation of ffap gives you other options. Apart from the name, the way the file is opened is simply intuitive without any fuss. In fact, the documentation lists other options to ffap that might useful for mouse users.
Sunday, June 8, 2008
A better parentheses matching emacs package
For those who find the default parenthesis matching a bit lacking in features, the mic-paren package offers additional features that can be useful. I've been using it for quite some time and frankly, don't recall what I'd miss if I lose it. I mean, I've got used to thinking that this is the default behaviour of Emacs.
An indicative list of features from the package commentary...
An indicative list of features from the package commentary...
- Both forward and backward parenthesis matching (simultaneously if cursor is between two expressions).
- Indication of mismatched parentheses.
- Recognition of "escaped" (also often called "quoted") parentheses.
- Option to match "escaped" parens too, especially in (La)TeX-mode(e.g., matches expressions like "\(foo bar\)" properly).
- Offers two functions as replacement for `forward-sexp' and`backward-sexp' which handle properly quoted parens (s.a.). These new functions can automatically be bounded to the original binding of the standard `forward-sexp' and `backward-sexp' functions.
- Option to activate matching of paired delimiter (i.e., characters withsyntax '$'). This is useful for writing in LaTeX-mode for example.
- Option to select in which situations (always, never, if match, if mismatch) the entire expression should be highlighted or only the matching parenthesis.
- Message describing the match when the matching parenthesis is off-screen(vertical and/or horizontal). Message contains either the linenumber orthe number of lines between the two matching parens. Option to select in which cases this message should be displayed.
- Optional delayed highlighting (useful on slow systems),
- Functions to activate/deactivate mic-paren.el are provided.
- Numerous options to control the behaviour and appearance of mic-paren.el.
Thursday, June 5, 2008
PDF autorefresh with AucTeX and Sumatra PDF
For users of Emacs on windows, Acrobat Reader does not play well with AucTeX. If the PDF file is open, while compiling the .tex file, Emacs will throw a write error because the reader locks the file for it's own use.
Sumatra PDF seems to have sorted this issue out in it's latest release of the viewer. At least that's what the release notes claim. I haven't tried it so far. But the announcement on the comp.text.tex newsgroup caught my eye and I think it's worth noting.
If it really works as advertised in the release notes, then one does not have to close and reopen the PDF file when generating it through AucTeX. With the autorefresh feature, it should be possible to iteratively add text and compile in a smooth workflow.
I shall have to try this feature and switch the reader if all goes well. The last time I tried the Sumatra PDF viewer I had problems rendering pgf rendered drawings. Maybe things are better this time as I did not fully check what was and was not supported in the earlier releases.
Sumatra PDF seems to have sorted this issue out in it's latest release of the viewer. At least that's what the release notes claim. I haven't tried it so far. But the announcement on the comp.text.tex newsgroup caught my eye and I think it's worth noting.
If it really works as advertised in the release notes, then one does not have to close and reopen the PDF file when generating it through AucTeX. With the autorefresh feature, it should be possible to iteratively add text and compile in a smooth workflow.
I shall have to try this feature and switch the reader if all goes well. The last time I tried the Sumatra PDF viewer I had problems rendering pgf rendered drawings. Maybe things are better this time as I did not fully check what was and was not supported in the earlier releases.
Wednesday, June 4, 2008
Listing code snippets in LaTeX
There are a number of ways and packages that provide for code listings in LaTeX. One that I personally prefer and that has enough options to customise is the listings package. It provides a multitude of options to pretty print code snippets. It has support for a number of languages which is more along the lines of keywords that is just about enough for code listings.
It has features to
It has features to
- Number the lines
- keyword highlighting
- Ability to add your own keywords
- provide background colour
- whitespace identification for languages that need them
- labeling them for cross reference
Friday, May 30, 2008
Extracting specific pages from PDF files using LaTeX
I frequently receive large PDF files from my colleagues which needs to get reviewed by a number of people. Instead of mailing the whole document, especially if it is large, I mail them the relevant pages.
You don't need any extra software or some external binary. There is the package pdfpages on CTAN which does exactly what is required and more.(If you read the documentation, that is)
A simple example demonstrates the ease by which PDF pages can be extracted.
\documentclass[a4paper]{scrartcl}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=72-74]{statistics.pdf}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Of course, it can also be merged with the current document that one is writing in LaTeX too. So if someone sends in PDF images that needs to be incorporated in your workflow, just plug in some \includepdfs with the name of the file and compile the document. And it is simply plugged in without any fuss. So, if you're the delegating type, this is a godsend. :-)
You don't need any extra software or some external binary. There is the package pdfpages on CTAN which does exactly what is required and more.(If you read the documentation, that is)
A simple example demonstrates the ease by which PDF pages can be extracted.
\documentclass[a4paper]{scrartcl}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=72-74]{statistics.pdf}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Of course, it can also be merged with the current document that one is writing in LaTeX too. So if someone sends in PDF images that needs to be incorporated in your workflow, just plug in some \includepdfs with the name of the file and compile the document. And it is simply plugged in without any fuss. So, if you're the delegating type, this is a godsend. :-)
Wednesday, May 28, 2008
OOXML, objections raised!
By golly, South Africa seems to have some objections over the document format and the approval process that it has officially lodged a complaint. This is going to delay things even more on a normally staid and slow standards body.
Engaging in a bit of schadenfreude, it will be that once the complaint is registered, more complaints will be lodged by other parties once the approval process document trail is shown.
And it's not going be pretty.
Engaging in a bit of schadenfreude, it will be that once the complaint is registered, more complaints will be lodged by other parties once the approval process document trail is shown.
And it's not going be pretty.
Tuesday, May 27, 2008
Email attachments and Gnus
When you receive files in your email and they're embedded in the mail message, a quick way to save them is to hit K o. With a numerical prefix, it will save the nth inline or MIME attachment.
If the file is large and you want to strip it from the mail message, K O will do the trick. Again, deleting the same can be done via K d, because some mail clients will stupidly resend the attachments when replying without stripping it first as a default behaviour.
More useful commands can be found here.
If the file is large and you want to strip it from the mail message, K O will do the trick. Again, deleting the same can be done via K d, because some mail clients will stupidly resend the attachments when replying without stripping it first as a default behaviour.
More useful commands can be found here.
Friday, May 23, 2008
Make LaTeX emulate Microsoft Word paragraph spacing
This might be useful for someone who needs to make LaTeX behave like Microsoft Word in its paragraph spacing. You know, the one where the words are stretched to fill in the entire text line area. Well, to achieve that, you need to do the following
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
Hat tip to Donald Arseneau on this thread. Note that, it makes hyphenation of words very,very unlikely.
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
Hat tip to Donald Arseneau on this thread. Note that, it makes hyphenation of words very,very unlikely.
Wednesday, May 21, 2008
An useful emacs shell setting
This is another useful addition to your .emacs; To prevent that command line from staying at the bottom in your emacs shell. Though this doesn't seem to work on my win32 emacs and cygwin bash shell.
hmmm....
Edit: in the same thread the following suggestion works for win32 Emacs at least.
(setq comint-output-filter-functions '(comint-watch-for-password-prompt))
Now, the prompt is pretty much centred in the middle of the screen
Edit 2: More additions, this seems to be the correct way
(add-hook 'shell-mode-hook
(lambda ()
(remove-hook 'comint-output-filter-functions
'comint-postoutput-scroll-to-bottom
t))) ; LOCAL
hmmm....
Edit: in the same thread the following suggestion works for win32 Emacs at least.
(setq comint-output-filter-functions '(comint-watch-for-password-prompt))
Now, the prompt is pretty much centred in the middle of the screen
Edit 2: More additions, this seems to be the correct way
(add-hook 'shell-mode-hook
(lambda ()
(remove-hook 'comint-output-filter-functions
'comint-postoutput-scroll-to-bottom
t))) ; LOCAL
Subscribe to:
Posts (Atom)