Smokes your problems, coughs fresh air.


Another contributed Readline keyboard shortcut

Last Wednesday, I was given a very nice response with a great tip to my table of Readline keyboard shortcuts by Luca City. Yesterday, Lance Levine gave me another extremely nice response and another great tip:

Just wanted to say appreciate the nice readline cheatsheet. There were a couple I never knew (the ctrl-alt-asterisk is gonna be a real time saver) and I never knew about ctrl-G or ctrl-J to end incremental searches either.

One that might be worth knowing for a lot of people if you ever make updates, would be the ctrl-x-x cmd. which takes you to the beginning of the line (and then back again if you hit it again). I enjoy working in screen, and the default ctrl-a escapes you from readline when you’re in a screen session so I never use it lest get confused.

Best Regards,
Lance Levine

Well, Lance, I’m an avid GNU screen user myself, so your tip is very useful to me! I’ve added it to the table to ease the suffering of our fellow GNU screen users. 🙂

Indeed I did, but I found it difficult to come up with a concise and clear description of the shortcut. So difficult, in fact, that I didn’t succeed at it:

Ctrl+x+x readline keyboard shortcut with ugly description

So, what does the Readline user manual have to say that may help me with a description?

exchange-point-and-mark (C-x C-x)
Swap the point with the mark. The current cursor position is set to the saved position, and the old cursor position is saved as the mark.

While typing, the mark normally is at the beginning of the line. Pressing Ctrl-x-x will move the cursor to the mark and set the mark to the old cursor position. If you now move the cursor and press Ctrl-x-x again, the mark won’t be at the beginning of the line but at place where you moved the cursor to. This means that the Ctrl-x-x shortcut is more than just a way to move back and forth between the beginning and ending of a line.

Another goody worth mentioning is the Ctrl-@ shortcut which will simply set the mark at the current cursor position or at the position specified by a numeric argument.

Now, I just need to think of a way to integrate these two Readline command bindings into the table without the descriptions taking up as many lines as this blog post. 😕 Any bright ideas, anyone?

eps2eps to the rescue when epstopdf complains of no bounding box

PDFLaTeX doesn’t like encapsulated postscript images. If you want to use .eps files with pdflatex, you can convert these files to PDF using Sebastian Rahtz’ epstopdf, and then remove all .eps file extensions from the image locations in your .tex source files. Then, the latex command will look for .eps file and the pdflatex command will look for .pdf, .jpg and .png files.

The other moment, I tried to do just this. But, epstopdf complained about the lack of a bounding box in one of my EPS files. Indeed, the conversion finished but generated a huge white background with the actual image somewhere in the lower left corner. From the man-page:

epstopdf transforms the Encapsulated PostScript file so that it is guaranteed to start at the 0,0 coordinate, and it sets a page size exactly corresponding to the BoundingBox. This means that when Ghostscript renders it, the result needs no cropping, and the PDF MediaBox is correct. The result is piped to Ghostscript and a PDF version written.

If the bounding box is not right, of course, you have problems…

Luckily, while tab-completing from eps to epstopdf, I noticed the eps2eps utility. I though: What if this utility happens to sanitize the EPS file a bit? A quick look at the man page and a test run later, my hope was confirmed: epstopdf would now generate a nice PDF file without complaining.

The epstopdf manual page could be amended to: If the bounding box is not right, you might want to try to run eps2eps first.

© 2024 BigSmoke

Theme by Anders NorenUp ↑