Categories
Uncategorized

LaTeX formulas in xfig

To add LaTeX formulas to xfig

  1. add a text element, and enter LaTeX including $$
  2. edit the text element properties, and mark it special
  3. export as PDF/Latex
  4. in the LaTeX file, include the figure using \resizebox{\textwidth}{!}{ \input{thefilename.pdf_t} }
Categories
bash

latex -> text

$ catdvi -e 1 -U file.dvi | sed -re “s/\[U\+2022\]/*/g” | sed -re “s/([^^[:space:]])\s+/\1 /g” > file.txt

from

this link

More details from the original poster:

The -e 1 option to catdvi tells it to output ASCII. If you use 0 instead of 1, it will output Unicode. Unicode will include all the special characters like bullets, emdashes, and Greek letters. It also include ligatures for some letter combinations like “fi” and “fl.” You may not like that. So, use -e 1 instead. Use the -U option to tell it to print out the unicode value for unknown characters so that you can easily find and replace them.

The second part of the command finds the string [U+2022] which is used to designate bullet characters (•) and replaces them with an asterisk (*).

The third part eats up all the extra whitespace catdvi threw in to make the text full-justified while preserving spaces at the start of lines (indentation).

After running these commands, you would be wise to search the .txt file for the string [U+ to make sure no Unicode characters that can’t be mapped to ASCII were left behind and fix them.

Categories
bash samba

smbclient, beamer, and pgfpages

Today’s problem is that I need to print slides for a poster session that I’m going to. I’ve never printed to the color printer, so I don’t know the share name. Simple:

[sourcecode lang=”bash”]
smbclient -L server.com
[/sourcecode]

prints all the shares from that server, so then I can just grep the output since I have an idea how the admins name the printers (based on room number, floor, and printer model). I found the share name and made a little shell script that prints to the share. I also found that there’s a number of commands one can send through smbclient to the server and share, such as:

[sourcecode lang=”bash”]
smbclient -d3 //server.com/printershare -A authfile -c "queue"
[/sourcecode]

and even

[sourcecode lang=”bash”]
smbclient -d3 //server.com/printershare -A authfile -c "help queue"
[/sourcecode]

for example. Then there’s “cancel”. However on my particular setup, I didn’t see any print jobs listed when I gave the “queue” command even though I knew there was one queued up. Maybe it’d been sent to some 3rd intermediate machine, or maybe it was already in the printer’s memory.

Next, I needed to get my beamer slides printed to the color printer. I printed them, and it turns out they’re shrunk down for no reason (but they’re color, so that’s good). I need them normal size to paste onto the poster board. To do that, I found the beamer manual giving an example using pgfpages (which had a few typos and again used a4paper which is a nuisance since I’m in the USA). Had to investigate pgfpages.sty (since pgfpages has no documentation, surprise). The correct command to get pgfpages to print on my system this time was:

[sourcecode lang=”tex”]
\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[letterpaper, landscape, shrink=5mm]
[/sourcecode]

For a while my problem was using curly rather than square brackets for the 3 parameters. Now the problem is that the color laserjet 2500L just prints pages of junk rather than the slides. In the process of dealing with that I found that I could “login” to the print share by doing

[sourcecode lang=”bash”]
smbclient -d3 //server.com/printershare -A authfile
[/sourcecode]

and then issue commands like “cancel 1” and “cancel 100” directly. They all succeed, but I never get to actually see the queue.

Finally the other struggle with this morning and afternoon has been with the HP Color Laserjet 2500L itself. Downloading the manual is essential, since the printer has nothing but hieroglyphics on its panel. I don’t know why people think that a red button with a triangle automatically means cancel print job. In any case, reading the manual is essential, since a button was flashing with some hieroglyphic next to it, and I discovered this meant paper jam, which gave me the impetus to actually pull out the toner cartridge (which I’d never done, I don’t maintain this printer) and then find the paper and replace the cartridge. And somehow, now, my slides are actually printing in color.

I think one important thing is to do dvips to get the postscript output rather than making a PDF file and converting to PS using pdf2ps. The file seems alot smaller. It is very slowly printing right now, which suggests to me that one of the older jobs where I did pdf2ps is printing, instead of my latest jobs using dvips.

Categories
bash

bash completion for vim and latex

I want bash to complete .tex whenever I type vim file. and there’s a file.tex in the directory. This was driving me nuts since it was completing all the LaTeX aux files etc whenever I did it, but I found (again) /etc/bash_completion which has the line

complete -f -X ‘*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)’ vi vim gvim rvim view rview rgvim rgview gview

which is obviously the line in question. all i did was add (aux|out|log to these filetypes and put that line in my bashrc and its working much better. frankly this was just lucky, since i dont think more than about 50-200 people in the world really understand bash completion very well.

there’s an incredible programmer i came across who wrote something interesting called compleat.

also i rediscovered FIGNORE, which is a list of file extensions for bash to ignore on all completions. just export it from your .bashrc.