Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Thursday, September 27, 2012

Making Emacs Act More Like a Text Editor

Emacs used to be a great programmer's editor. It still is, but non-text features keep creeping in making it less usable for editing and viewing text. For example, doc-view mode makes emacs render a PDF, DVI, or PS file. But PDF and PS are text formats, so I can't imagine why I'd want emacs to render them--other tools do that well.
To make emacs better-behaved, it seems the following in one's .emacs file is sufficient:

(add-to-list 'auto-mode-alist '("\\.pdf\\'" . fundamental-mode))
(add-to-list 'auto-mode-alist '("\\.ps\\'" . fundamental-mode))
Thanks to Stefan Monnier at https://groups.google.com/forum/?fromgroups=#!topic/gnu.emacs.help/TGVh05FGzK8
My .emacs file (really, my emacs-custom.el which is loaded from my .emacs) has been growing since Fall 1988, and I don't see that changing, especially as new puppies start monkeying with emacs' behavior. Of course, I do trim detritus from time-to-time.
Actually there might be some stuff in there from my time at William and Mary, 1984-1986. Zippy says "yow."

Friday, October 7, 2011

Generating Portable PDF

Yes, that's right, the subject, expanded, says "generating portable portable document format."  I got a shock this week when a PDF I had generated on a Linux system using LibreOffice 3.3.4 would not display on either of two XP systems I tried to show it on. The first time was in class, when I thought I was going to display an example. The issue is that LibreOffice used a font that the Windows systems didn't have. I googled it and installed a font with almost the same name, but it made no difference. It turns out one can force PDF to live up to its name in LibreOffice by specifying PDF/A-1a in the PDF options. Thanks to someone at a blog I can't find right now [ Jean at http://www.taming-openoffice-org.com/newsite/?page_id=77 ] for pointing out to me that the settings are persistent, so when chosen once it is unnecessary to deal with it later.

The persistence seems like an inconsistency in LibreOffice: how are we to know there isn't a configuration option buried in the myriad of randomly-organized menus? How are to know the setting is persistent? It seems most are not.

To date I have encountered no portability problems with PDFs generated from LaTeX, dvips, and ps2pdf.

Wednesday, June 29, 2011

Printing to PDF, Firefox, Ubuntu

Off and on I've been irritated that Firefox print-to-file functionality defaults to postscript with the filename before the .ps extension blank. What's up with that? This is more of an issue now that I have a Kindle, and thus print to PDF much more often than to paper, so tonight I poked through about:config, shrugged, and turned to Google. I found one useful page, http://ubuntuforums.org/showpost.php?p=7890849&postcount=7, but prefer "my" way to his, simply because my filter places exactly the right configuration lines on the screen, leaving nothing to manual hunting.

1) Enter about:config.
2) Type print_to_filename in the filter bar.
3) Place exactly the same path, file name, and extension in each setting.

This is what mine now looks like:


Needless (I hope) to say, different folks will have different printers, and so my entry for an HL-2040 will be atypical and most other people will have printers not shown here.

There is no generally-useful file name, so indicating the application that generated the PDF seems a reasonable choice. IMHO, /tmp is the only reasonable directory to use so that the user's home directory isn't littered. Littering $HOME is an unfortunate tendency of Linux developers.