Thursday, September 19, 2013

htlatex and pdflatex

I'm a big fan of the gnuplot tool that has an output terminal of pdflatex. This produces a pdf figure with an overlay of latex for beautiful results. Similarly, inkscape has an output format with pdf overlayed with latex.

I had a problem with htlatex. I use pdflatex and so everything is a pdf in my figures. My overlayed output from latex, with the file extension 'pdf_tex' uses an import file and then includegraphics at the bottom. htlatex complained it couldn't find the bounding box of my pdf file... which is reasonable enough as htlatex calls pdftex and apprently doesn't support including pdfs.

My solution was to include the following in my preamble. This allows the file to continue to work as previously with 'pdflatex' and when 'htlatex' is called, the convert program is called to generate a eps file.

 \graphicspath{{figures/}{results/}}

% call as:
% htlatex myfile.tex  "" "" "" -enable-write18
%
\makeatletter
\LetLtxMacro\latexincludegraphics\includegraphics
\@ifpackageloaded{tex4ht}
    {\renewcommand{\includegraphics}[2][]{%
        \immediate\write18{s=\Ginput@path; (IFS='{}'; for i in $s; do convert ${i}#2 ${i}#2.eps; done)}%
        \latexincludegraphics[#1]{#2.eps}}}
    {\renewcommand{\includegraphics}[2][]{\latexincludegraphics[#1]{#2}}}
\makeatother

Notes: 
  • you must call htlatex with -enable-write18 so it can execute commands in the shell.
  • you must include your graphics path setup before this gubbins.

Monday, July 29, 2013

scribus, latex, and bibtex

I've been playing with scribus. I managed to get bibtex working with my rendered frame and am recording the steps here.

1. create your latex frame, and include your bibliography stuff at the end of the document as you would for a normal document. i.e.

\bibliographystyle{abbrv}
\bibliography{refer}

2. Find out what the current temporary filename scribus is using for rendering is. It will be mentioned in the 'Program Messages' listing. The file will be in the $TEMP directory.

3. Jump into that directory and copy your bib file into the $TEMP directory.
4. Run bibtex on the temporary filename.
5. Run latex again, and again, using the 'Update' button on the Editor dialogue.



Thursday, April 18, 2013

I wanted to find the difference between accessed and modified epochs of a bunch of files. The incantation below gives you this number for each item in a directory:

$ stat -c "%X %Y %N" ~/* | awk '{diff = $1 - $2; print diff, $3}'
40449 '/home/home/my_cgi'
2173034 '/home/home/run_pvr.sh'
124618 '/home/home/tools'

Saturday, December 29, 2012

powerpc-eabi-ranlib: command not found

I'm trying to compile wiimc, these two pages have proved very helpful setting up my compile environment and getting to the point of building wiimc. However, my make in wiimc directory falls over complaining:

libtool: install: chmod 644 /opt/devkitpro/portlibs/ppc/lib/libfribidi.a
libtool: install: powerpc-eabi-ranlib /opt/devkitpro/portlibs/ppc/lib/libfribidi.a
../libtool: line 947: powerpc-eabi-ranlib: command not found


The solution I found is to run make with dir1, dir2 and dir3, then to cd into the directories for dir1, dir2, dir3 and run make install separately. Like this:

$ make dir1; make dir2; make dir3
$ cd ./fribidi; make install; cd ..
$ cd ./libexif; make install; cd ..
$ cd ./libiconv; make install; cd ..

This is suitably hacky for my needs.

Wednesday, September 12, 2012

Compiling No Hands on F17

I'm back on F17, on at least one machine I use regularly. I've been looking at No Hands that will allow me to use my desktop as a hands-free set for my mobile. The mobile communicates with the desktop using bluetooth.

I've got it to compile by installing dependencies piece-meal and using the following incantation:

LDFLAGS="-lpthread `pkg-config -cflags --libs dbus-1`" ./configure CXXFLAGS=-fpermissive

I haven't actually got the code working yet (seems I should fiddle with bluetooth?) Any suggestions are welcome.

Tuesday, August 7, 2012

connecting a tunnel to a reverse ssh connection and mounting with sshfs

I have a machine (treestump) that connects to a server with a known ip address (applecart). treestump opens a reverse proxy connection onto applecart at port 29999. From applecart, I can connect to treestump from applecart by issuing: 'ssh me@localhost -p 29999'. I have password less logins configured.

I'm on my machine here (rainplant). rainplant can't see treestump but does have an account and passwordless login to applecart. I want to mount treestump using sshfs. This requires two steps.

1. Set up a tunnel all the way through to treestump.
    ssh -L localhost:1999:localhost:29999 me@applecart
1.a Test the connection.
    ssh me@localhost -p 1999
2 Mount using sshfs
    sshfs -p 1999 me@localhost:/storage/ ./treestumpstorage

I saw a suggestion to use autossh, this makes sense to me on treestump.

Sunday, July 29, 2012

For what it's worth: I've been really enjoying gnome3 and I like the direction it's taking.