Thursday, October 9, 2014

Converting M/S Word to LaTeX source. Hex codes

I know there is some tool out there that does this, but if  it's just a matter of fixing a few
characters that seem to vanish when you export the word doc to plain text,
then it's useful to know that the unicode hex for

... (ellipsis) is 2026
long dash is 2013
hyphen is 2d
left double quote is 201C
right double quote is 201D
left single quote is 2018
right single quote is 2019

To find the code for a character (visible or not) in a file
open with vi, move the curso to it and type ga

Examples:

To convert all double left quotes to the LaTeX equivalent in vi:
:1,$s/\%u201C/\\lq\\lq/g


e with an acute accent is unicode hex 00e9, so to convert them all to LaTeX:
:1,$s/\%u00e9/\\'e/

Mixing greek and latin text in LaTeX Ubuntu

Don't use the math mode $\alpha$, etc for ordinary greek words.

$ sudo apt-get install texlive-lang-greek

Add to preamble:
/usepackage[greek, english]{babel}
% makes latin/english the default

In the document, switch in and out of greek with
\greektext .... \latintext ...

This allows you to type greek on your keyboard.

An alternative is the switch with
\begin{greek} .... \end{greek}
I haven't used this. It's possibly better for extended greek text.
I've just been interested in putting in occasional words and
short phrases.

Example:

These grounds are quite sufficient for deeming
mathematical training an indispensible basis of real
scientific education, and regarding, with Plato,
one who is \greektext `agewm'etrhtoc%
\footnote{\latintext -- {\it ageometretos }, i.e. ignorant of geometry
(or, perhaps, unskilled in geometry, or indifferent to geometry).
The motto said to have been
carved above the entrance to Plato's
Academy was: \greektext O`udeic `agewm'etrhtoc e`is'itw --
\latintext {\it Let no-one
ignorant of geometry enter.}}
\latintext as wanting in one of the
most essential qualifications for the successful cultivation
of the highest branches of philosophy.
}


How to use Sumatra pdf reader on Ubuntu

Download the windows executable SumatraPDF.exe
and (install and) use wine.

To use it by default, make a script, say sumatra, that does
wine SumatraPDF.exe $1
and make it the default by picking any pdf, right-click -> properties -> open with
and selecting sumatra.

(I found Adobe heavy with Ubuntu Linux 14.04 on an old computer, and inclined
to freeze or crash. Sumatra is much leaner and faster, and works fine.)

Embedding fonts in a pdf made with pdflatex, linux

$ pdf2ps file.pdf
$ ps2pdf -dPDFSETTINGS=/prepress file.ps file-w-embedded-fonts.pdf

(If you don't do this, then the software reading the pdf may make
font substitutions.  This matters if it is proprietary software used by
some printer, for instance.)

Canon MF3010 scanner on Linux Ubuntu 14.04

The MF3010 printer/scanner would print but not scan on Ubuntu, when I first got it. This has now been sorted out, at least to the extent that I can scan.  I'd like to acknowledge the help of the Ubuntu Forum. It has this nice feature that you can sign up to receive an email whenever there is a new post on a specific topic.

Step 1: I first followed these instructions to
download and build sane-backend from source:

In a new subdirectory $HOME/MF3010/sane-backends:

$ sudo apt-get install libusb-dev
$ git clone git://git.debian.org/sane/sane-backends.git
$ cd sane-backends/
$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
$ make

(For more detail see:

 http://jonathan.bergknoff.com/journal/scanning-ubuntu-canon-mf3010

The instructions at the end of that piece,
involving moving stuff in the system, are deprecated in the
forum, and anyway can't be used as they stand with Ubuntu 14.04.

Note that libusb is an absolute prerequisite for
any kind of sane functionality.

The make step takes a long time, with many warnings, but
works, as far as I can see.)

Step 2: Second, I uninstalled the version of libsane that came
with Ubuntu14.04.  This automatically removed xsane and
simple-scan as well.  I used the package manager with the GUI,
Ubuntu Software Center.

Third, in directory $HOME/MF3010.sane-backends:

Step 3:
$ sudo make install

With that done,
$ scanimage -V
gives:
scanimage (sane-backends) 1.0.25git; backend version 1.0.25

(Note: you have to have a match of versions here. If you get

scanimage (sane-backends) 1.0.25git; backend version 1.0.23

it means that the old libsane was not removed, or has crept back in.
It will creep back in if you try to reinstall simple-scan
with the package manager, and you'll have to go back to step 2.
)

$ scanimage -L
gives
device `pixma:04A92759' is a CANON Canon i-SENSYS MF3010 multi-function peripheral

You are now good to go.
$ scanimage -h
gives help.

$ sudo scanimage >filename.pnm
gives scary warnings, and I hope I haven't just installed
a trojan, but it
scans whatever is on the scanner plate and saves it as a pnm,
which you can manipulate using gimp (for instance)
into any format you like.

Moving contacts from Blackberry

Blackberry phones allow you to copy contacts from SIM to phone, but when you want to go the other way you have to copy them one at a time. (This was fixed in recent BB's, BB10).  So how do you quickly get your contacts from an old BB to Android?

Solution: Use bluetooth.

I guess this might also work for other phone systems as well.

Purpose of this blog: solutions to technical problems

Here I blog notes on technical issues resolved.
By technical, I mean anything to do with ICT, desktop publishing, all software, machinery.
Mainly, I'll post short notes on things that gave me trouble and are now dealt with.
I'll leave all posts open for comment, so that others can add to or correct what I write.