Archive | editing RSS for this section

Random useful Word stuff

Notes to self.

(http://www.fileformat.info/info/unicode/category/Sm/list.htm)

(‘␣’ means empty space, eg one hit of the space bar; ‘Alt-x’ means hold down ‘Alt’ and press ‘x’. If a space is not marked with the empty space character, it is just used to separate commands and should not be typed.)

in Word, type ␣2212 Alt-x to get a proper minus sign, not an en rule or a hyphen; it sits at the right height and gives the right spacing. The space in front is not always needed, but may be needed to separate the ‘2212’ from the previous characters so Word knows what to apply the ‘Alt-x’ function to. Here are the other ones I find most useful:

Useful Alt-x codes for maths in Word

If in the ‘Advanced find’ dialogue I select ‘Use wildcards’ then the search differentiates between non-breaking spaces and spaces.

Just some stuff.

Other stuff.

 

 

 

 

Search insde Word, PDF, XML and other files—installing and using crgrep

I am an editor in a business that uses Micro$oft products, but I want to be able to use the Linux CLI tools with which I am moderately familiar. In particular, I want to be able to grep Word documents, and that’s a problem because the new Word file format chops the text up and zips it up and hides it away. I googled and read a bit about crgrep (‘common resource grep’). Here is my experience so far.

Downloaded from

https://bitbucket.org/cryanfuse/crgrep

or

https://sourceforge.net/projects/crgrep/

Created a subdirectory c:\Users\username\installs\crgrep and downloaded the zip file into it. Worked in Cygwin, hence the forward slashes and dollar signs in the following. This could also be done through the GUI or in a PowerShell or CMD window. Choice is a wonderful thing.

$ unzip crgrep-1.0.5.zip
$ cd crgrep-1.0.5/
$ vim INSTALL.txt

OK, so it needs java. Does it need the compiler (probably not, but check…). In the crgrep folder, typed:

$ grep -ir javac

Returned no results calling the javac compiler. So it looks like the program needs the runtime but not the development kit (JDK), so that’s good. It’s what you’d expect. Now, I have the wonderful ImageJ installed (works effortlessly in userspace), and it installs the Java runtime environment, JRE. Maybe I can use that.

Now, according to the INSTALL.txt file, the JAVA_HOME variable that crgrep wants points at something like

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_xx

and my grepping told me that java.exe should be in %JAVA_HOME%\bin\java.exe

In Cygwin, my ImageJ tree looks like:

/cygdrive/c/Users/username/installs/ij/ImageJ/jre/bin

Which meant I needed to set JAVA_HOME to be C:\Users\username\installs\ij\ImageJ\jre (Windows-style path) (that is, the variable points the directory with the bin directory inside it, not the bin directory or the binary file itself.)

But first checked the version — needs 1.8.

$ cd ../../ij/ImageJ/jre/bin/

$ ./java.exe -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

OK.

I installed in userspace (work computer, no root/admin access), so I went to my Windows account settings (given the various versions of Windows, I’ll assume a user can find their own account setting page) and (for Win 10; Win 7 is no doubt different) in the ‘Find a Setting’ box I typed ‘env’ for ‘environment variables’, and chose ‘edit the variables for your account’. Note that searching for ‘path’ turns up nothing. It’s a little trick!

Added an entry to the path:

(Path → Edit → New)

c:\Users\username\installs\crgrep\crgrep-1.0.5\bin

and created a new environment variable:

JAVA_HOME=C:\Users\username\installs\ij\ImageJ\jre

And exited everything, esp. the command line window, then opened it again, typed SET in a CMD (‘DOS’) window to see if the new variables were present, then tried the command:

H:>crgrep --help
usage: crgrep [options]  []
crgrep: Common Resource Grep.
 -a,--text               Process binary files or database columns as if
                         they were text
    --color        Alias for 'colour'.
    --colour       Colour-highlight matched text ('always', 'auto'
                         or 'never'). Default colour is red, see USAGE.txt
                         for other colour settings.
 -d,--database           Database grep (disables file search)
 -h,--help               Help
 -i,--ignore-case        Ignore case distinctions in matched text
 -l,--list               List resources which produce a match by name. No
                         content is searched.
 -m,--maven              Include Maven POM file dependencies in search
    --mood    Only include matching content expressing a
                         specific sentiment; values include 'positive',
                         'negative' or 'neutral'. Ignored if -l specified.
                         Requires model data; see INSTALL.txt
    --ocr                Enable OCR text extraction from images; requires
                         tesseract libraries. See INSTALL.txt
 -p,--password      Password required to access a resource,
                         optionally used with -u
 -P,--proxy         Proxy settings for http access, specified as
                         [:]
 -r,--recurse            Recursive search into resources
 -u,--user          User ID or username required to access a resource
 -U,--uri           URI to specify a JDBC database resource
 -V,--version            Print the version number of CRGREP to the
                         standard output stream
    --warn               Display all warnings to standard output
 -X,--extensions    Enable one or more extensions; comma sep. list
                         such as -Xdebug,trace
If  is not specified, or is '-', read from stdin
Please report issues at https://bitbucket.org/cryanfuse/crgrep/issues

OK, promising.

I want it for grepping Word files, so let’s see… yes, it finds ‘data’ in the test file, and outputs a nice clean stream:

H:>crgrep data text.docx
text.docx:T:A key part of his research was the analysis of large
datasets. As part of this he developed a software suite that included
data modelling, reduction and correction techniques, and made of use the
National Computing Infrastructure and other supercomputers. He enjoys
the challenge of analysing and explaining complex data using words and
carefully designed graphics. He likes Linux and the LATEXtypesetting
system.

How about PDF? Converted the Word doc to PDF using the ‘Save as’ dialogue in Word. Then…

H:\>crgrep data text.pdf
text.pdf:1:36:datasets. As part of this he developed a software suite
text.pdf:1:37:that included data modelling, reduction and correction
text.pdf:1:40:challenge of analysing and explaining complex data using

Different output because of how PDF and Word chop up the text, but instances found in both cases. No need to specify a file type or anything. I have not explored the command line options, but I am already finding the program useful — for example, when I want to find multiple instances of multiple expressions (say acronyms or references) in multifile projects.

Kudos.

Just grepping around.

CAPS LOCK disable on Windows without admin rights

Lots of sites tell you how to disable/remap CapsLock. But what if you don’t have administrator rights? Most of them tell you to pry off the key. Well, instead, I went to:

https://dropline.net/2009/05/mapping-caps-lock-to-control-without-admin-access/

Here is an extract, which I put here just in case the original site vanishes, as sites sometimes do:

There’s a duplicate of the keyboard mapping registry key under HKEY_CURRENT_USER, which non-administrators can modify, and it appears to behave exactly like the key under HKEY_LOCAL_MACHINE.  So, for anyone in a similar position, here’s the registry key to modify:

HKEY_CURRENT_USER→Keyboard Layout→Scancode Map =
hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

You can download a registry update file here.  Save it to your computer, double-click it to update your registry, then reboot and enjoy your vastly-improved keyboard.

Here is a screengrab of the .reg file:

capslock

Worked a treat on Windows 7, but it did not work on Windows 10.

Hmm…Code for conversion of CapsLock to Shift is:

00,00,00,00,00,00,00,00,02,00,00,00,2a,00,3a,00,00,00,00,00

(http://johnhaller.com/useful-stuff/disable-caps-lock)

Codes explained here:

https://www.experts-exchange.com/articles/2155/Keyboard-Remapping-CAPSLOCK-to-Ctrl-and-Beyond.html

But why it does not work in Windows 10 I don’t know. I did try it on a work desktop machine (that’s why I don’t have admin rights, ‘cos it’s a work machine), so perhaps it downloads registry files on logging in? Does that make any sense?

Right now I don’t care enough to find out, but I’ll look into it at some point in the future.

 

So there.

Add LibreCaslon (to name one) and Computer Modern (to name two) to Word

Not much really.

Now, if you do not have admin rights it is more interesting:

  • Right click.
  • Swear.
  • Go to https://portableapps.com/download
  • When asked, select ‘Local — install for current user’ or similar.
  • Finish installing.
  • Use the Explorer to go to: C:\Users\username\PortableApps\PortableApps.com\Data (‘username’ is the login name of the user installing the software).
  • Create a ‘Fonts’ folder in there.
  • Put the OTF files into this folder.
  • Start the Portable Apps Platform (if no shortcut/menu entry is available, go to C:\Users\username\PortableApps\PortableApps.com and run PortableAppsPlatform.exe). If it was started during installation, stop it and restart it.
  • Open Word, say, and LibreCaslon now appears in the fonts menu.
  • Close the Portable Apps Platform and it will not be accessible, though Word might still list it.
  • Add any other fonts you like this way, but they’ll only be available while the Portable Apps Platform is running, and you’ll need to stop it and restart it to make them appear. On the other hand, installation/removal is really simple; to uninstall, turn off the platform and remove from the Fonts folder!

Lots of other great applications (LibreOffice, gnumeric, GIMP, all that) are available through the Portable Apps Platform.

lc_list

Oh, Computer Modern is at https://www.fontsquirrel.com/fonts/computer-modern and https://www.ctan.org/tex-archive/fonts/cm-unicode/fonts/otf.

 

Meh.

Changing the language in Word comment boxes

M$ Word does have a lot of power. It’s very successfully buried. Here’s a thing: the proofing language for the text is set separately from that for any comments you add to the text. It is I suppose a good thing to have separate control over these types of content. The language for comments is determined by the template for the file and may not be what you want. The link below goes to a very useful explanation that shows how to set it to be what you want. I include it here because I found it so useful. I don’t often reblog.

Source: Changing the language in Word comment boxes

Wordy.

Non-breaking en rule (en dash) in Microsoft Word… not really.

Say you’ve got a number range. The proper way to format that is with an en rule (en dash), so it looks something like ‘4­–5’ whereas a hyphen would look like ‘4-5’. Now, you probably don’t want the number range to break across lines. That’s fine with a hyphen, since Ctrl-Shift-Hyphen gives a non-breaking hyphen (in Word). But you don’t want a hyphen you want an en rule. One option is to put in a non-breaking hyphen then make it twice as wide.

  • Highlight the non-breaking hyphen (and the hyphen alone, not any trailing/leading characters or spaces).
  • Right click on the hyphen and select the ‘Font…’ menu, then ‘Advanced’ (rule #1 in Microsoft products: Just about anything worth doing is considered ‘Advanced’).
  • Change the number in the ‘Scale’ box to be about 200%.
  • Exit from the menus.
  • Type an en rule in your document, alongside the stretched hyphen. (Ctrl-Keypad Minus.)
  • Compare.
  • Swear.
  • Use it anyway since it’s the most reasonable alternative. You may want to adjust the height; but will this highly manual fix work if font is then changed? No.
  • Watch while Word mysteriously moves the instruction to widen the characters to random places in the document so you end up with double width text in unexpected places.
  • Swear.
  • Learn LaTeX where all you need to type is \mbox{4–5}.
Dialog box in Microsoft Word for changing character size, position and spacing.

Stretch out the hyphen (or anything else) using the ‘Scale’ box. Gives fixed selections but can type in other values. Something between 175% and 225% usually works. Note: Can also be used to adjust the position if need be.

I have tried putting text in boxes, but the baseline is not maintained – it sits high. Character positions can be adjusted down, but then Word boxes clip the contents. Perhaps there is a better solution? I tried making it an equation, or using a minus character, but neither was really satisfactory. I’d like to hear about a better answer because, sadly, using LaTeX is not always viable.

Non-bresaking en rule in Word; results of stretching a hyphen.

Non-breaking en rule in Word; results of stretching a hyphen.

My Word.

My new work profile.

I am now officially an editor… http://www.biotext.com.au/staff/darren-goossens/. From the company website:

A grab from the Biotext website, as it was in May 2017.

A grab from the Biotext website, as it was in May 2017.

Further updates as they come to hand…

Biotext

This week I started work at Biotext, a company that specialises in writing and editing complex scientific documents. It’s incredibly exciting — it’s the kind of opportunity that does not often come along. There’s a huge amount to learn, but that is part of the enjoyment.

As the name suggests, their focus has often been on biological material, though in the broadest sense — agriculture, environment, and medicine feature strongly. I’m hoping to increase the expertise in the physical sciences.

I looks like a chance to bring together science and writing, and it has come along at a time when I was on the lookout for a new job.

Good luck to me!

 

Bizz.

Word madness: Can’t save, won’t save. ‘A file error has occurred’

Word's useless error message. Notice the 'Was this information helpful'. What do you think?

Word’s useless error message. Notice the ‘Was this information helpful’. What do you think?

 

Got this error, and they had the temerity to ask me if it was helpful. Pricks. Anyway. Could not save to new name. Could not save to external media. Could not save elsewhere on C:. In short, could not save.

No.

No.

One bit of advice I have read is to wait till Word does an autosave, then kill Word using task manager. Then when Word is restarted it will give an option to rescue the file. Sounds dangerous to me. Waited but save did not come.

First thing I did was print to PDF with all track changes and everything visible so I would at least have a record of what the file looked like.

Then created a new blank file. Tested that it could be saved. Yes. And in the same folder as the original file. (I knew that should be OK since I printed to PDF into the same folder).

Went to file I wanted to rescue, with track changes visible and all comments visible. Ctrl-A, Ctrl-C
Went to new empty doc and pasted. Got text and comments but not the track changes information. Well, that is still useful as a backup.

Save.

Now, it should be possible to make a copy with track changes information.

https://word.tips.net/T001783_Pasting_Text_with_Track_Changes.html

Another handy way to copy the text is to use the spike. Word users are so familiar with using the Clipboard to cut, copy, and paste information that we often forget about the spike. This is an area of Word that acts like a secondary Clipboard, with some significant differences. (You can learn more about the spike in other issues of WordTips or in Word’s online Help.) To use the spike to copy and paste text with Track Changes markings intact, follow these steps:

  1. In the source document, select the text you want to copy.
  2. Press Ctrl+F3. The text is cut from the document and placed on the spike. (If you wanted to copy, not cut, then immediately press Ctrl+Z to undo the cut. The selected text still remains on the spike.)
  3. In the target document, place the insertion point where you want the text inserted.
  4. Make sure that Track Changes is turned off in the target document.
  5. Press Shift+Ctrl+F3 to clear the spike and insert the spike’s text into your document.

So I went to source document ant hit Ctrl-A, then Ctrl-F3.

Opened blank with same template, track changes turned off (it is by default I think).

Shift-Ctrl-F3

But does not save! The problems have come with it!

So that does not help.

Now, if I turn off track changes and accept all changes, I can save the document – so it is a bug somewhere in Word’s track changes code.
If the problem occurs again, can try the spike method with the different aspects of track changes turned on and off, to narrow it down.

So no satisfactory solution discovered. I do not know what change I put in that caused the issue, and it has never occurred before. So… I dunno. The above ideas are just partial solutions.

 

Solutions to problems nobody asks about.