Archive | writing RSS for this section

File creation from command line in Libreoffice

I would like to be able to just type

$ libreoffice /path/to/filename.odt

and create as well as open an odt file. This would save messing around with GUI file dialogues.

This is sort of possible.

$ libreoffice newfile.odt

does not work.

$ libreoffice --writer newfile.odt

does not work.

$ libreoffice -n newfile.odt

does not work.

$ soffice --writer newfile.odt

does not work.

$ soffice --writer 

or

$ libreoffice --writer

opens a blank Writer screen but you then have to use the Save dialogue to name the file.

$ touch /path/to/filename.odt

$ libreoffice /path/to/filename.odt &

sort of works. touch creates an empty file, which libreoffice (or soffice) will open as a text file. If you hit Ctrl-s within LibreOffice you will have to tell it to save as odt, but you don’t have to navigate to the folder you want.

Sadly, giving an extension (odt, odp, ods) does not help LibreOffice choose the right program to use to open the file. They are always treated like plain text and always opened in Writer, even if you type something like

$ touch test.odp

$ libreoffice --impress test.odp

So that’s less than optimal. if one can be bothered, there is a bodge that lets this happen more cleanly. I opened LibreOffice Writer and created a blank file, called blank_writer_doc.odt and put it in ~/bin, and similar for Calc. I don’t use the other tools enough to bother.

Then in ~/bin created the following script, called Writer:

$ cat Writer
if [ -f "$FILE" ]; then
  echo "File $FILE exists. Replace? y for yes, anything else for no."
  read replace
  replace=q$replace
  if [ $replace = "qy" ]; then
    echo "File $FILE overwritten with blank document."
    cp ~/bin/blank_writer_doc.odt "$FILE"
    libreoffice "$FILE" &
  else
    echo "Opening existing file."
    libreoffice "$FILE" &
  fi
else
  echo "File $FILE does not exist. Created."
  cp ~/bin/blank_writer_doc.odt "$FILE"
  libreoffice "$FILE" &
fi

And now I can type

$ Writer newfile.odt$

and it works.

The bit with adding ‘q’ to the response means that the response is never empty, so the if does not barf if the user just hits ‘Enter’. (If if is asked to work on an empty response, you get:

 line 5: [: =: unary operator expected

Writer.

Advertisements

Predatory or legit? I dunno, but … GBP1500?

Predatory publishers or legit? It’s not always easy to spot. What about this one?

screeenshot of email asking me to contrinute to a book chapter; text extracts below.

Email from InTechOpen asking for a contribution to a book chapter.

Note how the list of institutions is empty!

Dear Dr. Goossens,

Due to your involvement in the field, and the research you published in your paper, “Synchrotron X-ray diffuse scattering from a stable polymorphic material: Terephthalic acid, C8H6O4,” IntechOpen invites you to extend your work and offer a more comprehensive overview of your studies. Contribute a chapter to “Synchrotron Radiation,” an upcoming Open Access book edited by Dr. Name Name.

Work with an internationally recognized peer group and gain increased visibility for your published work. Please visit the book project page to register your interest.

We look forward to hearing from you.

Kind Regards,

Marija Gojevic-Zrnic, from IntechOpen
Author Service Manager

It’s correctly written, their website looks more or less professional, their books do certainly get printed and distributed — I’ve seen them in proper libraries. They’re open about their (high in my opinion) fees — £1500 for a 16 to 20 page chapter. So are they predatory or just expensive? I guess they’re just expensive.

I still would not publish with them.

Why?

Something like IUCrJ (fee of USD1300, or about £1000, so quite a bit cheaper) covers similar topics, is also open access, is part of a society publisher of high standing, has a reliable archiving policy and is embedded in all the major search engines and databases. I have no experience with the editorial process at InTech, and it may be very good, I can’t say, but I do know that the IUCr process is superb, with their editors doing more than just farming out the material to review — they genuinely interrogate it themselves.

The issue? IUCrJ might bounce the work! Also, book chapters are often more review-y and may not be publishable as papers.

But … if you are career-conscious, ask; will the book chapter collect citations anyway? Will it fall through the cracks of whatever research metric engine your bosses want to see quoted? Sadly, this is the reality. Monographs and book chapters might be excellent and important, but will they be noticed? I suggest finding a good-looking chapter or two from an InTech or similar volume and then checking its stats in whatever database you use for citation and impact metrics — Web of Science or whatever. Is it there? Are the numbers reasonable? And so on.

In the end, if you want to go open access, there are reputable journals that will take your money, and £1500 is enough to get into some pretty reputable ones. And conventional publication still exists. InTech might be OK, but check it out first and be aware of the options!

It’s all about due diligence.

 

 

Successful science writing and editing

Recently I attended a workshop called ‘Successful science writing and editing‘, facilitated by Kath Kovac, a freelance editor and trainer who often works with Biotext, my employer. Kath did a great job. She has a lot of experience in writing and editing technical material, built up over many projects working with CSIRO and many other organisations. She wears the erudition lightly, which is great.

While a lot of the material was familiar — after all, I work in the area — it was good to see how another professional thinks about it and talks about it. Every editor has their own set of things that irk them. It seemed to me Kath is particularly attuned to pointless openings to sentences. Sentences that begin with ‘There are’ or ‘There is’ or (worse) stuff like ‘It should be noted that’.

For example:

Instead of: There are many sentences that, like this one, are longer than necessary.

How about: Many sentences, like this one, are longer than necessary.

It seems like a small change, but if every sentence gets a little sharpening, the whole document gets an amazing lift. It becomes more engaging, clearer and easier to read and understand. Some writers do this instinctively, the rest of us have to make conscious checks.

I also enjoyed the contributions of the attendees. No matter how familiar the material, the people are always new when you’re training or educating, and that keeps it fresh. A microbiologist gave us the definition of biosolids. We explored structuring documents, and the example was a fact sheet about the benefits of eating quoll.

All in all, a very enjoyable and illuminating experience! Though we never got to taste quoll.

I even got a certificate.

 

Training

 

A little fix on a Hermes 10

So my Hermes 10 had a little problem; the ribbon vibrator was not dropping down after lifting the ribbon into place. That meant my deathless prose was obscured. Given how many errors I make that may not be a bad thing, but still…

Bitmap image of the typewriter.

Hermes 10 electric typewriter with the upper casing removed.

 

bitmap of the problem part with the part highlighted

Sticky ribbon vibrator indicated by the red arrow.

I tackled it two ways, both at once, so I don’t know which was more important.

First, I just very lightly lubricated the various bits of the mechanism, working from the ribbon position all the way back to the various lever arms and whatnot near the keyboard.

In doing this, I noticed that while there was a spring drawing the mechanism back (and the vibrator down) attached near the top-right of the keyboard, there was no such at the top-left.

bitmap image showing the spring that was already in the machine.

The arrow points to the spring near the top-right of the keyboard. It draws back the ribbon vibrator mechanism, causing the ribbon to drop out of the way.

Now, in most manual typewriters the vibrator is not symmetrical — it’s operated from one side or the other but not both, so such an arrangement would not be that much of a surprise. But on the 10 the mechanism is more symmetrical, with levers and rods on both sides and the ribbon holder moving perfectly vertically on a rail rather than being lifted up by a lever arm from one side. So it seemed reasonable that there should have been a spring on the left, especially since there was a little pin there with nothing to do but hold the end of the absent spring.

bitmap showing the spring

The mismatched spring I added to the mechanism on the top-left.

 

To cut a boring story a little short, I found a little spring in my parts bin (not matching, but that’s OK) and attached it, and an the problem went away.

The 10 is not a bad machine. It combines the evenness and regularity of an electric machine with the satisfying thwack of typebars on paper. Its gentle hum is not disturbing. It is a heavy beast — portable only in the sense it is not bolted down — and the key tops sit high due to the electrical paraphernalia underneath. But typing on it is effortless and the result is very tidy.

And now, thanks to my fiddling about, the ribbon vibrator gets out of the way and lets me see what’s going on.

Here are some more pictures.

image of the typewriter, without its upper case.

Some more pictures of the topless Hermes 10.

It certainly isn’t the most invisible fix I’ve done, but it works and makes the machine much more user friendly, so worth doing indeed.

10 10 10 10.

Printing PowerPoints with notes two (or more) to a page (repeat)

This is just a text-only version of the previous iteration with some new details. Just for the record. I had to work up the documentation, so why not post it?

This is what I did to print out PowerPoint slides two per page including the notes underneath.

There is (as of 2018) no option in the PowerPoint print dialogue for this. Note also that I do not have access to a full version of Adobe Acrobat Professional or whatever they are calling it at the moment.

(1) ‘Designed’ notes text in PPT; something like 12 pt for notes and 9 pt for refs/sources (Myriad Pro, though Univers works well too). Formatted notes consistently. To work with the slide notes in the text block under the slide, used ‘Notes Page’ under View. Can resize and so on and get WYSIWYG while formatting.

(2) Used CutePDF (http://cutepdf.com/) to print to PDF file. Went into Advanced settings for CutePDF and made sure paper was A4. Set Print Quality to ‘1200 DPI’, Set TrueTypeFont setting to ‘Download as Softfont’. Under PostScript Options set PostScript Output Options to ‘Optmimize for Portability’ and TrueType Font Download Option to ‘Native TrueType’. Other PDF print options might be acceptable; don’t know. Mac tends to work better with PDF than Windows. Cannot just use ‘Save as PDF’ option from the File menu because that does not give the notes pages.

The Print settings for PowerPoint (rather than the printer) were:
* Color (sic)
* Portrait
* Collated
* Notes Page (Print slides with notes)
* Print all slides (or the range you want)
* Printer: CutePDF
* No header or footer

Then printed and saved the file.

(3) I decided to crop the resulting PDF using a command line tool, because that is highly reproducible — I can get exactly the same cropped box every time.

I used pdfcrop.sh in Cygwin. Cygwin (https://www.cygwin.com/) is a Unix-like environment for Windows; pdfcrop.sh would probably work seamlessly in a command line terminal on a Mac if the software tools it draws on were already installed, possibly through Macports or similar.

pdfcrop.sh is available from https://askubuntu.com/questions/270493/how-to-crop-a-multi-page-image-scanned-pdf-file-which-wont-crop-with-pdfcrop, and also from https://darrengoossens.wordpress.com/2018/02/25/crop-every-page-in-a-multipage-pdf-file.

The pdfcrop.sh command looked like this:

$ pdfcrop.sh -t "105 112 105 112" infile.pdf outfile.pdf

The four numbers are how much to crop from left, top, right, bottom; I worked them out by opening the PDF in GSview (http://pages.cs.wisc.edu/~ghost/gsview/), a Windows-based viewer for PostScript and PDF files that gives coordinates of the pointer, so I could just move my mouse to where I wanted to crop and note down the coordinates.

I know there are graphical cropping tools, but this works and can do lots of pages. Feel free to use whatever tool works for you, but keep in mind that the ability to make exactly the same crop box every time is very useful. An automatic cropping of white space is not ideal since might vary from slide to slide or vary with alterations of the PPT file. It will also fail to remove any page numbers or footers/headers that are present.

(4) I now had a PDF file with the pages, including notes, cropped to have narrow margins. The next step was to put two onto a single landscape page. You can do this by opening the cropped PDF in say Acrobat and then printing to PDF again, after selecting ‘2 pages per sheet’ or equivalent in the print dialogue.

My preference was to use a command line tool. pdfnup (version 2.08 when I used it) is part of pdfjam, which in turn builds on the pdfpages stuff that is part of LaTeX:

$ pdfnup --batch --suffix '2up' outfile.pdf

This takes the ‘outfile’ from the pdfcrop.sh step and makes a new PDF with two pages per page and adds the suffix ‘2up’ to the file name, so the final file is ‘outfile-2up.pdf’

I have noticed that pdfnup gives less white space around the slides (and thus bigger images and text) than printing two per page using Acrobat.

Darren Goossens
darren.goossens@biotext.com.au

29 May 2018

Hermes 10 — portable as a microwave oven

The Hermes 10 is a funky machine from that generation of electric typewriters that were powered versions of manual ones — they still use a basket and typebars, and the paper goes past on the carriage, unlike say a Selectric where the paper sits still and the print head moves.

This one was bought at auction for less than $20 and it came with a case and a dust cover. The case is enormous. It could carry quite a few changes of clothes were it a suitcase. Here it is pictured beneath an Olivetti Lettera 32 in its case; the Hermes is damn near twice as wide and maybe more than that high. It’s also very heavy. And of course it needs a power socket to work, so the case is really for moving it from office to office. You’re not going to use this machine in Starbucks…

Olivetti Lettera 32 sitting on top of a Hermes 10.

It is big and heavy. It hums and smells a little like ozone — probably burning dust. It seems to work pretty well. The ribbon vibrator does not drop down as quickly as it should; I think it was over-oiled at some point (which is to say oiled at all). It seems to be in nice condition. The visible margins work, everything seems present and accounted for.

Hermes 10 from above.

One of the good things about this old design is that they do not take custom ribbon cartridges — they take conventional nylon ribbons on spools. That means unlike, say, to pick a completely random example, a CasioWriter cw-16, there’s no problem with getting ribbons even though the company behind the product is long gone, or at least long-left the industry.

Hermes 10 with the ribbon cover up, showing the conventional spools.

Touch is … odd. A bit like a big calculator. Pretty easy to get used to, though. Hitting return and watching the whole carriage zip back and the paper feed through is pretty nifty.

The arrangement of keys will be familiar to anyone who knows a Hermes 3000, though the backspace is where us computer users expect it to be — top-right rather than top-left as it is in the 3000. Here is the character set — one lonely accented ‘e’.

Character set from my Hermes 10.

Quite useful. Not as many fractions as older machines, but cents, at, pound and dollar.

The x, =, – and _ characters can repeat (for crossing out and drawing lines), though the _ and – cut lines through the paper; possibly an adjustment is needed or the platen is too hard. It’s a small enough issue and not enough to make me do major works on the machine.

Ser. no. 2052425 (http://typewriterdatabase.com/hermes.82.typewriter-serial-number-database), which places it in 1971.

Anyway, a real bit of big iron.

Monarch by Remington — the smell of oil and dust

Monarch by Remington, made in Holland in the 1960s. It was $5 and said ‘not working’ at the local recyclers. Turned out whoever put the label on did not know how to use the carriage lock. Needed a clean and the case has no base, only the lid and some ancient crumbling foam. The unit itself is very nice. Tabs, V-shaped paper stand, everything seems to work.

Character set shown below.

Ser. No. is hard to read; I think it is TY 487575, which puts it in 1965.

Keytops seem small and highly shaped and take some getting used to. Came with metal slot-together spools and a quite usable ribbon.

Not the most stylish of machines, but seems like a very useful typer. As bought some bowls and counters were clogged up (‘o’ looked like a solid black dot, for example), but the tip of a fine pair of tweezers sorted that out.

Some counters still not quite clean.

Yes, another one.

Casiowriter cw-16 character set (American keyboard)

Printed on thermal paper and scanned (and post-processed in ImageJ to tidy it up, but only a little). Includes some Greek, a good set of math symbols, accented characters, including the ability to put any accent on any letter, some fractions, degree/minute/second symbols, paragraph marks (pilcrow, is it?). Pre-dates euro, of course, otherwise pretty useful.

Scanned typed document.

Complete character set from Casiowriter cw-16, shown as typed on thermal paper.

 

Just for reference.

Crop every page in a multipage PDF file

Apply the same crop to every page in a multipage PDF file. Requires pdftk, Ghostscript, and sometimes pdf2ps/ps2pdf.

See end of post for copy of bash script. Found it at:

https://askubuntu.com/questions/270493/how-to-crop-a-multi-page-image-scanned-pdf-file-which-wont-crop-with-pdfcrop

I found best to use gv (or GSview) to get the right, left, top, bottom pixels to crop, then explicitly specify using the -t switch.

$ ./pdfcrop.sh -t "2 182 3 183" cw16.pdf cw16_crop.pdf

Note the quote marks around the crop values. They are in order left, top, right, bottom.

Try on Casiowriter manual from https://www.manualslib.com/download/777108/Casio-Cw-16.html. (See this bit of nonsense.)

Before:

Image of front page of manual, showing large white space bands at top and bottom.

Before using pdfcrop.sh

After (though one page — the second — came out wrong and I don’t know why, but I fixed that by first processing the original PDF, first I went pdf2ps then ps2pdf and made a cleaned up PDF; then all was perfect when I ran the cropper):

Image of front page of manual, showing no large white space bands at top and bottom.

After pdfcrop.sh

The script:

$ cat pdfcrop.sh
#!/bin/bash

function usage () {
  echo "Usage: `basename $0` [Options]  []"
  echo
  echo " * Removes white margins from each page in the file. (Default operation)"
  echo " * Trims page edges by given amounts. (Alternative operation)"
  echo
  echo "If only  is given, it is overwritten with the cropped output."
  echo
  echo "Options:"
  echo
  echo " -m \" [ [ ]]\""
  echo "    adds extra margins in default operation mode. Unit is bp. A single number"
  echo "    is used for all margins, two numbers \" \" are applied to the"
  echo "    right and bottom margins alike."
  echo
  echo " -t \" [ [ ]]\""
  echo "    trims outer page edges by the given amounts. Unit is bp. A single number"
  echo "    is used for all trims, two numbers \" \" are applied to the"
  echo "    right and bottom trims alike."
  echo
  echo " -hires"
  echo "    %%HiResBoundingBox is used in default operation mode."
  echo
  echo " -help"
  echo "    prints this message."
}

c=0
mar=(0 0 0 0); tri=(0 0 0 0)
bbtype=BoundingBox

while getopts m:t:h: opt
do
  case $opt
  in
    m)
    eval mar=($OPTARG)
    [[ -z "${mar[1]}" ]] && mar[1]=${mar[0]}
    [[ -z "${mar[2]}" || -z "${mar[3]}" ]] && mar[2]=${mar[0]} && mar[3]=${mar[1]}
    c=0
    ;;
    t)
    eval tri=($OPTARG)
    [[ -z "${tri[1]}" ]] && tri[1]=${tri[0]}
    [[ -z "${tri[2]}" || -z "${tri[3]}" ]] && tri[2]=${tri[0]} && tri[3]=${tri[1]}
    c=1
    ;;
    h)
    if [[ "$OPTARG" == "ires" ]]
    then
      bbtype=HiResBoundingBox
    else
      usage 1>&2; exit 0
    fi
    ;;
    \?)
    usage 1>&2; exit 1
    ;;
  esac
done
shift $((OPTIND-1))

[[ -z "$1" ]] && echo "`basename $0`: missing filename" 1>&2 && usage 1>&2 && exit 1
input=$1;output=$1;shift;
[[ -n "$1" ]] && output=$1 && shift;

(
    [[ "$c" -eq 0 ]] && gs -dNOPAUSE -q -dBATCH -sDEVICE=bbox "$input" 2>&1 | grep "%%$bbtype"
    pdftk "$input" output - uncompress
) | perl -w -n -s -e '
  BEGIN {@m=split /\s+/, $mar; @t=split /\s+/, $tri;}
  if (/BoundingBox:\s+([\d\.\s]+\d)/) { push @bbox, $1; next;}
  elsif (/\/MediaBox\s+\[([\d\.\s]+\d)\]/) { @mb=split /\s+/, $1; next; }
  elsif (/pdftk_PageNum\s+(\d+)/) {
    $p=$1-1;
    if($c){
      $mb[0]+=$t[0];$mb[1]+=$t[1];$mb[2]-=$t[2];$mb[3]-=$t[3];
      print "/MediaBox [", join(" ", @mb), "]\n";
    } else {
      @bb=split /\s+/, $bbox[$p];
      $bb[0]+=$mb[0];$bb[1]+=$mb[1];$bb[2]+=$mb[0];$bb[3]+=$mb[1];
      $bb[0]-=$m[0];$bb[1]-=$m[1];$bb[2]+=$m[2];$bb[3]+=$m[3];
      print "/MediaBox [", join(" ", @bb), "]\n";
    }
  }
  print;
' -- -mar="${mar[*]}" -tri="${tri[*]}" -c=$c | pdftk - output "$output" compress

Thanks to the inventor!

PDFishness.

Casiowriter CW-16: Fax rolls and batteries

What can I say? It was $5. A significant problem with these old things is that the cartridges/cassettes/ribbons/whatever are proprietary and no longer getting made. On the other hand, this old Casio can print thermally as well as using ink, and I have a bunch of old fax rolls kicking around.

Here is the test page (insert paper, hold down ‘code’ while turning on). It actually looks a lot better than this scan.

Did not come with a carry bag or AC adapter, but runs fine off 4 D-cells. Of course, they are worth more than the machine is.

At first it would not print properly using ink. It turned out the little cog that drags the tape through the cassette had come off. I found it inside the machine and, with a bit of jiggery pokery and a little dismantling and remantling, got it to work again. That was pleasing. Here is a fuzzy picture of the ‘compliance plate’. According to http://typewriterdatabase.com/, 1034105 is as unknown as all the others. I think they came out around 1984 or so.

So the consumables are the batteries and the fax paper, and the ribbon, but at least the ribbon is optional. You can have ribbon and plain paper or no ribbon and fax paper. Options, 1985 style.

This is the cassette. They are meant to be used once. If you rewind it, you can see the letters that have been pressed out of it. When these kinds of machines came into offices and such, this became a security concern. I have not bothered to read the previous owner(s) correspondence, but I did rewind the tape a little just to see if I could rewind it. It works pretty well. Not very well, since where the ink has been used there is no ink at all, but it was just an experiment. You can see the sticky tape I put on it (the clips that hold it together did not work too well on reassembly…)

Oh, here’s the LCD. It does not hold a lot of words, but it is useful, and easily viewable in bright light, unlike the screen on a modern laptop. Indeed, this is quite a reasonable machine for typing outdoors.

Actual user review: This was a fairly low-end machine in its day, but it is quite usable. It can print 12 or 10 pitch, double width, bold, underline. It has direct print (like a normal typewriter), line print (print a line once it is finished, either by return key or reaching the margin) and a reasonably effective fully justified mode, in which when it hits the right margin it adjusts word spacing before printing the line. It is easy to fix spelling mistakes, though much quicker if you don’t need to use the spell checker. The keyboard is not great. It lacks the positive feel of a good computer keyboard (say IBM-M), and also the sensitive touch of a modern keyboard. I found when I tried to type fast I often dropped letters. That’s probably the main failing, really. It’s quite large, not really compact, either. For example, does not fit in a standard-size briefcase. So it is a bit odd — it can run off batteries, as if it’s meant to be ported around, but it has a large footprint and is bulky to carry — bulkier than, say, an Olympia SF. (Which was not the last, was it?)

The 24-pin dot-matrix type is a bit spidery, especially thermally, though there are 5 impression levels. There is a good range of characters, including proper superscript 2 and 3, a few Greek letters and mathematical symbols. Can set line spacing, tabs, margins, etc. Recommends against using textured paper.

Conclusion: In 2017, even free is probably too expensive, but in its day it would have been a useful compromise between price, portability and capability. At least the thermal printing means the lack of replacement cassettes does not brick it.

Why oh why oh.