Archive | editing RSS for this section

Readability in LibreOffice

As of mid-2018, this seems to be lacking. I know it is of debatable value, but some projects demand a readability level.

Now, the document could be saved to docx and imported into Word. I have experimented with gnu style and diction. For that…

(1) I took the file and saved as .txt.

(2) The style program is in the Debian diction package:

$ sudo apt-get install diction

(3) Run it.

$ style filename.txt
readability grades:
Kincaid: 1.0
ARI: 0.9
Coleman-Liau: 3.4
Flesch Index: 100.9/100
Fog Index: 3.0
Lix: 21.8 = below school year 5
SMOG-Grading: 3.0
sentence info:
414 characters
105 words, average length 3.94 characters = 1.16 syllables
14 sentences, average length 7.5 words
7% (1) short sentences (at most 3 words)
0% (0) long sentences (at least 18 words)
12 paragraphs, average length 1.2 sentences
0% (0) questions
21% (3) passive sentences
longest sent 16 wds at sent 1; shortest sent 4 wds at sent 7
word usage:
verb types:
to be (3) auxiliary (0)
types as % of total:
conjunctions 3% (3) pronouns 10% (10) prepositions 11% (12)
nominalizations 0% (0)
sentence beginnings:
pronoun (4) interrogative pronoun (1) article (1)
subordinating conjunction (0) conjunction (1) preposition (0)

(4) Seems to work OK. Can use flags to tune the output as desired, and do it all on the command line if preferred:

$ odt2txt --stdout filename.odt | style

And of course that could be put in a bash script.

$ cat bin/
odt2txt --stdout $1 | style

Is it possible to create a simple macro to call such a script from within LibreOffice Writer? Probably.

But not right now. It would be easy to do this for LaTeX, too, I’d think. Something like dvitty or dvi2tty then style.



Clearing radio buttons in Word

Note to self.

When editing a Word document that has radio buttons in it — in my case, a checklist — I accidentally clicked on a button. But I want them all to be blank when I give the checklist to a user!

I have 3 buttons — Yes, No and na, and they are mutually exclusive, so I don’t want to use checkboxes.

But I find that once I have checked one radio button, I cannot easily undo it.

Screen shot showing the 'na' button checked.

I’ve checked the ‘na’ button and now I can check any one button but I want all to be blank.

It can be undone, and it’s actually not very difficult.

(1) Go to developer tab. Now, if the developer tab is not visible, go File → Options → Customize Ribbon and under Customize the Ribbon choose Main Tabs and then check Developer.

Screen shot showing the Word Options dialogue and within that the Customize Ribbon screen

Getting the Developer tab.

(2) On the Developer ribbon, choose Design Mode.

(3) Right-click on the troublesome button and choose Properties.

(4) Find Value and change it to False (just delete True and type False).

Screen shot showing the button's properties.

Change ‘True’ to ‘False’.

(5) Exit the Properties panel by clicking on the red X top-right. The button is reset. It will also reset if you hit Enter after typing False.

(6) Close Design Mode. You’ll see that the buttons still work as they did before.

Note: Sometimes you’ll get a very long list of properties and Value won’t be there; look at the top — have you actually clicked on the button? Beside (Name) it should say the button name, in this case, ‘OptionButton61543’. If it says something like ‘ThisDocument’, you’ve clicked on whitespace beside the button, not inside the button. Just try again! Maybe click elsewhere on the page and then go back to the button. Try clicking on the button then right-clicking, etc.


Clear for action.

Windows 7 update hangs on Stage 3 of 3

Several computers in the office did an update-y kind of thing when booting and then sat there on the blue screen saying they had reached stage 3 of 3. Nothing happened for quite a while.

Note: The message did not say ‘installing update 3 of 3’. It talked about stages.

The spinny thing kept spinning and the mouse still worked, but there was no percentage count or anything.

Turns out, it didn’t hang, it actually finished the update but didn’t switch to the log-in screen.

Tried Ctrl+Alt+Del.

Also known as the ‘three-finger salute’.

Yes, that brought up the log-in screen and all was well.


That will be all.

xFig convert all

xFig is hardly cutting edge any more, but it has some useful advantages; .fig files can be edited in a text editor, and much more readily than eps files, and fig2dev can output a whole bunch of other formats and can be run on the command line.

This is just a ‘note to self’ giving a little script that converts all the fig files into other formats ready for insertion into web pages or  documents. It generates eps, emf and svg files and puts them into appropriate directories, creating the directories if need be.

Can add any number of conversion targets to the list, but bitmap ones (png etc) generally need options to ensure the resolution is good enough. That precludes putting them inside the inner loop. The png example shows how this works. I have magnified it by 4, which, when the image is shrunk back to original size, has the effect of quadrupling the pixels per inch relative to the default. The default is low — a screen resolution, so something like 96 ppi.

$ cat
for f in *.fig
  prename=`basename $f .fig`
# Vector formats don't need custom arguments
  for extn in eps emf svg
    mkdir -p $extn
    echo "fig2dev -L $extn $f > $extn/$prename.$extn"
    fig2dev -L $extn $f > $extn/$prename.$extn
# Bitmap formats need custom arguments
  mkdir -p png
  echo "fig2dev -L png -m 4 $f > png/$prename.png"
  fig2dev -L png -m 4 $f > png/$prename.png

Just run it in the folder where the files are.



Windows path to Mac/Linux path

I work in a place that uses Macs and Windows machines, plus I use Cygwin. We collaborate on documents that live on a server. The windows machines map the server to G:, the Mac machines go to ‘groups’.


This takes a Windows G: path and converts it to one for a Mac so I can send a colleague an email saying ‘file is at groups/xxx/xxx/’ and they can get at it readily.

@echo off
echo %1 | sed "s/\\/\//g" | sed "s/G:/groups/g"

It uses sed to first replace backslashes with forward (recalling that slashes need to be escaped and the escape character is the backslash … makes for a funny looking command). Second sed just replaces ‘G:’ with ‘groups’. It is called thus:

H:> w2m "G:\00-Level1\00-Level2\01-2018\ABC\ABCDEF\PANEL\01 Drafts\file-name(01) and etc.docx"
"groups/00-Level1/00-Level2/01-2018/ABC/ABCDEF/PANEL/01 Drafts/file-name(01) and etc.docx"

And there is a reverse one called m2w.bat that lets me open their paths easily on the Windows machine I have to use.

The quotes are because modern file names can have spaces, brackets and all kinds of things that can mess things up.

Paths of glory.

PDF to emf or svg for putting vector graphics in Word

Started with multipage PDF document.

Cropped out the bit I wanted.

First, I extracted the page I wanted. I have all the Poppler stuff installed in Cygwin, so:

$ pdfseparate -f 4 -l 4 whatiscc1.pdf page4.pdf

(-f means first page to extract, -l means last) Then I cropped out the bit I wanted of that page 4.

I did that by opening it in gv and noting the pixel coordinates.

I used pdfcrop from TeXLive, and I’ll confess I iterated a few time to get the coordinates I wanted.

$ pdfcrop --margins "-52 -250 -20 -25" page4.pdf page4-crop.pdf

So now I had my PDF image.


Fired up Inkscape and use the internal import, but that looked a mess.

Tried ‘Poppler/Cairo’ import — looked good.

Saved as an Inkscape svg, wmf and emf, using default settings.

Back in Word — Insert → PIcture Chose the emf; looked good. So did the wmf and the svg.

Now, it is not a complex image with many paths, gradients, fills etc, so YMMV.

Command line

Inkscape can also be used thus:

$ inkscape.exe page4-crop.pdf -l page4_test.svg

And this svg file was fine too.

Note that the command line use seems to use the native PDF import, which is not as good as the Poppler/Cairo-based one. I have had a couple of occasions when the command line run did not work and I used Poppler/Cairo import via the GUI.


Simple way to launch Cygwin programs on Windows start-up

I wanted to launch a few programs on Windows start-up, but some of them run through Cygwin. Now, installing the XDG menu creates a shortcut in the Windows start-up folder than launches the X server automatically.

So the simplest thing is to put a batch file into the Start-up folder that starts the programs (I still don’t call them ‘apps’) that I want.

Step1 was to hit the Windows button + R and type ‘shell:startup’ in the run box. That brings up the folder with the start-up items.


Properties of the XWin Server shortcut.

Step 2 was to look at the properties of the shortcut that starts the XWin Server (right-click and Properties). The line that launches the X server looks like this:

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin"

which calls the Cygwin command run and uses it to launch bash and within that the script that starts X windows (startxwin).

Step 3 was to create a batch (.bat) file in the C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup folder, and use commands modelled on this use of run but with the commands I wanted. Here is an example (my_start.bat):

sleep 30s
REM Win+R then type shell:startup and look at Target in XWin Server 
REM and copy that format to a new batch file and then put that batch 
REM file in the Start-up folder.
C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/local/bin/mrxvt &"
C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/kcharselect &"

On reboot, the computer runs the batch file and the 30s wait makes sure that the X server is up and running ready to launch the commands. Don’t know if it’s really necessary to wait, but it does not hurt.

Note that I have gnuwin32 tools installed, which is where the sleep command is found. It might work without it, but this works for me. See here.


Finding and inserting characters: KCharSelect, Cygwin and Windows

I think this is nifty. Very handy for finding and inserting unusual characters.

I have Cygwin installed on my Windows machine. I have the XDG menu installed (Cygwin package xwin-xdg-menu) and it launches on startup.

I installed KCharSelect, so in the XDG menu, one of the entries is the character selector (like the ‘character map’ from Windows) from KDE. So I click on ‘Show hidden icons’ and drill down and choose KCharSelect.

Screen shot of selecting KCharSelect from the x d g menu.

This is the pop-up menu (XDG) Cygwin installs into the Windows notification area.

When it starts, it looks like this:

Screenshot showing the application running.

The KCharSelect window.

Now, it beats the Windows character map because it has the search box. I type ‘dagger’ and I get a list of all characters with that in the name. I can put the character into the copy bar at the bottom by double-clicking. If I hit ‘To Clipboard’ then the whole contents of the bar is copied ready for pasting. But I can also highlight a single entry (or two) and right click to copy just that.

Then I can tab out to any Windows application, not just Cygwin ones, and paste it in. Here is the dagger pasted into Excel.

Now, this is handy because of the search box and because I can keep everything I’ve used in the copy space at the bottom.


PowerPoint, accessibility and alt text

PowerPoint accessibility stuff. Office 365 as of August 2018.

With the presentation open and in Slide View, I first, right click on some object on the PowerPoint slide and select ‘Edit Alt Text…’

Screenshot of the meu

Second, on the Home ribbon, select ‘Arrange’ and in the menu that drops down, select ‘Selection Pane…’

Showing the menu for selecting 'Selection Pane'

This gives a screen something like this, with two panes down the right-hand side:

Showing the selection pane screen.

The red arrows note the two important places to work. First, the box where the alt text is entered. Click on an object then either mark it as decorative or add the alt text.

Second, the Selection Pane for ordering the elements. Even if the alt text is nice if the elements are read in the wrong order the slide will not be clear to the user. Note that in this example ‘Title 1’ is below ‘Content Placeholder 2’. It is preferable to read the title first, so we reorder by dragging.

But note that for some reason the list is in reverse order – the first thing read will be at the bottom!

It seems best to start with the Selection Pane, ordering the elements and then adding alt text to each or marking each as decorative if it can be ignored.

The eye to the right of each object in the Selection Pane determines whether it is visible or not. This means each slide can have a title (and titles should be unique) for accessibility reasons, without the title actually being visible in all cases. This allows slides to have parallel structures even when, visually, there’s no need. Parallel structure is very useful. If each slide begins in the same way and all similar elements (photos, graphs, tables) are treated in the same way, the listener does not have to work as hard to figure out what the content is.

Lastly, an overall rule: the best way to approach it is to begin with the intended message of the slide, and order the elements based on that, then add any alt text that is needed for the reader to get the message in a coherent way. This may need hidden linking text as well as conventional alt text.

Alt text is a means of getting a message across, not an end in itself.

Windows 10 Narrator is here:

To get directly to Narrator settings, press Windows logo key + Ctrl + N.

To turn Narrator on and off, press Windows logo key + Ctrl + Enter.

Not sure how to use it to test alt text.



xFig font selection

It’s a bit 20th century, but I like it.

xFig is an idiosyncratic but useful vector drawing program that comes with most Linux distributions. It also works under Cygwin and on Mac. It’s still maintained and it works well with LaTeX. These are the fonts it gives you — the famous 35.

An example of each of the available fonts.

The fonts available in xFig, default install.

Just put here for reference.