Archive for the ‘Software’ Category

h1

Word: Find duplicated words

December 6, 2017

This find/replace is based on Paul Beverley’s work, so full acknowledgement to him for teaching me how to do this via his YouTube videos and his free book.

********

Some of my authors inadvertently type the same word twice (e.g. is is, the the), and it’s often hard to pick these up when editing. If you run spellcheck, you may find them, but there’s no guarantee of that. The find and replace below uses wildcards to find any instance of duplicated words, followed by a space or a common punctuation mark, and then replaces that with a single word and the trailing space or punctuation.

NOTE: This find/replace only finds words with the exact same case, so it will find ‘the the’, ‘THE THE’, and ‘The The’, but it won’t find instances where each word has the same letters but with different cases (e.g. ‘the The’, ‘The the’, ‘tHe thE’ etc.)

Steps:

  1. Press Ctrl+H to open the Find and Replace dialog box.
  2. Click More, then select the Use wildcards option.
  3. In the Find field, type: (<[A-Za-z]@)[ ,.;:]@\1>
    (Note: There’s a space in there, so I suggest you copy this Find string.)
  4. In the Replace field, type: \1
  5. Click Find Next then click Replace. Repeat.

 

How this works — at least how I *think* it works:

  • Find: Look for the start of any word (<) made up of any number (@) of letters ([A-Za-z]) followed by a space or punctuation ([ ,.;:]) then repeat that find (@\1) until you can’t any more words that match the pattern (>).
  • Replace: Replace the first element (the first of the duplicate words) with itself (that’s the \1 bit), which effectively deletes the rest.

[Links last checked December 2017]

h1

Word: Find a year followed by a comma and replace with a semicolon

November 22, 2017

Another early morning question posed on Facebook…

The person was trying to use Word’s wildcard find and replace to convert all strings of Authorname nnnn, Authorname nnnn, Authorname nnnn, Authorname nnnn (i.e. any author’s name, followed by a 4-digit number for a year, such as Smith 2005, Jones 1997, etc., followed by a comma, followed by another author’s name etc.). He wanted to convert all the comma separators to semicolons, ending up with Authorname nnnn; Authorname nnnn; Authorname nnnn; Authorname nnnn. (I’ve italicised the text for clarity — it wasn’t in his original.)

Wildcard find/replace is all about finding the pattern and then figuring out how best to interpret that pattern in a meaningful way in how you search for what you want, and how you replace it with what you want.

In this example, an author name always ends in a lower case letter, is followed by a space, then four numbers for the year, a comma, a space, then an upper case letter for the next author’s name. The last item in the list doesn’t quite match the pattern (no comma, space, upper case letter following it),  but that one doesn’t need to change so we can ignore that variation to the pattern. He wanted to keep everything except the comma, which he wanted to change to a semicolon.

Here’s how I solved it using Word’s wildcard find and replace  (there may be a more elegant solution, but this one worked for me):

  • Find: ([0-9]{4})(,)( )([A-Z]) 
  • Replace: \1;\3\4

If you need to use this, I suggest you copy it as there’s a space in the third set of parentheses that you can’t see.

How this works:

  • Find: Look for any number from 0 to 9 [0-9] that has 4 digits {4} — this is the first element and is surrounded by parentheses. Then look for a comma (another element, so also surrounded by parens). Next look for a space (wow, more parens), and finally look for any upper case letter [A-Z] and as it’s a unique element, surround it by parens too.
  • Replace: Replace the first element (the 4-digit number) with itself (that’s the \1 bit), then a semicolon, then replace the third and fourth elements of the find with themselves (e.g. \3\4).

You keep everything you don’t want to change (elements 1, 3, and 4) and only change the second element by typing a semicolon in between elements 1 and 3.

 

 

h1

Word: Wildcard replace with a backslash

November 22, 2017

This morning, well before I was properly awake, I solved a problem someone had posed on a Facebook group I’m in. They had an issue getting Word’s wildcard find and replace to do what they wanted and had asked members of the group to help. I’m writing this up for my own future reference as there’s some information in here about the peculiarities of the backslash character that I may need to use again in the future. [Random fact: The backslash character is known by several names, including the reverse virgule and the reverse solidus.]

The person was trying to find an easy way to find all instances of 3x and replace with 3\x\. Actually, she was trying to do more than that — if she’d only been looking for that, then a normal find/replace should work. For the rest of the string, however, she really needed to use wildcards. Where she was getting stuck was defining the Find correctly, and then the Replace.

Here’s my solution (using wildcards):

  • Find: (3)(x) 
  • Replace: \1^92\2^92

How this works:

  • First, look for 3 followed immediately by x. I separated them in the Find string with parentheses so that I could treat them as separate elements in the Replace string.
  • Next, for the replace, type \1 to replace the first element (the 3) with itself, then type ^92 to add a backslash character (you can’t type a \ as that won’t work), then \2 to replace the second element of the Find with itself (i.e. the x), then another ^92 for a final backslash character.

Two things to note:

  • The backslash is an escape character in a Find, so if you need to find one, you need to surround it with square brackets and ‘escape’ it — i.e. [\\] in a Find.
  • The backslash is a special character in Replace too as it designates the element you want to replace with itself. Instead, you have to use ^92 in place of a \.

 

h1

Word: Print Comments only

November 14, 2017

You can print comments and track changes with a document easily enough, but what if you JUST want to print the comments in a Word document?

It’s a bit fiddly, but it can be done. Here’s how:

  1. Open the Word document that has comments.
  2. Go to the Review tab.
  3. Click the drop-down arrow next to the Show markup button.
  4. Turn off everything except Comments. You can only turn them off one at a time, so you’ll have to do the previous step and this one several times to turn off all the options except Comments. When you’re finished, only Comments should have a check mark next to it.
  5. Go to File > Print.
  6. Under Settings, the default to Print all pages. You don’t want that, so click the drop-down next to those words.
  7. Select List of Markup. Note: The Print Markup option at the bottom of the list should be ticked; if it’s not, select it too.
  8. Choose your printer as you normally, then click Print.

If you want to print out just one reviewer’s comments, repeat the steps above. When you get to Step 4, follow those instructions and then select Specific people from the Show Markup list and choose the person or people whose comments you want to print. Once you’ve done that, continue on from Step 5 above.

NOTE: I couldn’t find how to print just the comments in a Word document converted to PDF. Adobe Acrobat doesn’t recognise Word’s comments as comments, only its own.

h1

Word: Switch the number and punctuation order

October 29, 2017

On another blog post, Peter asked for some help:

I have hundreds of superscript characters (not footnote markers) that have a space before them and punctuation (periods and commas only) after them. I’m trying to delete the space and move the punctuation in front of it.

You can do this using a find/replace with wildcards. However, the instructions below DON’T differentiate between numbers that are superscripted and numbers that aren’t, so it will switch those too. If you don’t have any instances of <space>single ordinary number<period or comma>, then you should be fine. I suggest you try this on a COPY of your document and make sure you get what you want and nothing more, before using it on your main document.

Steps:

  1. Press Ctrl+H to open the Find and Replace dialog box.
  2. Click More, then select the Use wildcards option.
  3. In the Find field, type: ( )([0-9])([.,])
    (Note: There’s a space between the first set of parentheses. Because you have hundreds of these, there’s a good chance that you won’t have just single digit numbers. For multi-digit numbers, type this instead: ( )([0-9]@)([.,])
  4. In the Replace field, type: \3\2
  5. Click Find Next then click Replace. Repeat.

(Note: Only click Replace All if you are certain that no other ordinary numbers will be affected.)

What you are doing here is looking for a space (item 1), followed by any single digit number (item 2), followed by either a period or a comma (item 3). Then you’re replacing that string with the period or comma (item 3) then the number (item 2).

 

h1

Endnote notes

September 16, 2017

These notes are for me, and were taken while I was attending an Endnote workshop prior to the IPEd conference in Brisbane, Australia, in September 2017. I’m documenting them here as my ‘brain dump’ as I know I won’t be able to read my handwriting after a few days! They may not be of use to anyone else.

  • Authors may put data into the wrong fields and therefore get an incorrect bibliography.
  • Authors may have chosen the incorrect reference type for the material (e.g. book, instead of journal article).
  • You can create your own style for your organisation. The easiest way is to display the refs list in an existing style  (e.g. Harvard), then click Edit > Output Styles > Edit ‘name of style’, then immediately do File > Save As and give your new style a name. THEN you can modify it to suit.
  • If the new output style doesn’t have a bibliography template for the reference type, copy the one from the closest to it (e.g. from Book), then click Reference Types and choose the new type from the list. Paste in the template formatting, then modify.
  • To add a new citation into an existing group of citations (e.g. ‘2, 5, 7, 8’), first convert citations to unformatted, add the new one, reformat, then update citations and bibliography.
  • To change the font etc. Word uses for the bibliography (by default it seems to be Times New Roman), do this in Word: Go to the Endnote tab, click the dialog launcher button in the Bibliography group, select the Layout tab, change the font etc.
  • You can have multiple libraries open at once but only the topmost one is the active one. Make sure if you have more than one Word doc open that you are using the correct Endnote library for the correct Word doc (ask me how I know this….).
  • Multiple docs can use refs from the one library.
h1

Excel: Convert hours and minutes to minutes

August 2, 2017

Converting hours and minutes (hh:mm) to minutes in an Excel spreadsheet is actually quite simple, once you know what to do. But I had to do quite a bit of trial and error and Googling to get it to work.

To convert hours and minutes to minutes, you have to multiple the hh:mm value by 1440 (which is 24 [number of hours in the day] multiplied by 60 [number of minutes in an hour]), AND make sure you set the formatting correctly for the both the hh:mm cells and the resulting minute cells. This is where I got caught — I didn’t have the correct formatting applied to the cells. Once I got that right, it all worked.

Here’s how…

  1. Enter elapsed times in hours and minutes (using the format hh:mm) in Column B. (Yes, those non-stop flights to/from Sydney to Dallas Fort Worth are killers!)
  2. Set the format for this column to Custom > h:mm. (To format the column, select the column header, right-click on it, select Format Cells, select Custom on the Number tab, then select h:mm from the list of types. Click OK.)
  3. Insert a new column (C) and called it Minutes.
  4. Set the format for the cells in this new column to Number with no decimal places — this formatting is critical for the formula to work. (To format the column, select the column header, right-click on it, select Format Cells, select Number on the Number tab, then change the Decimal Places value to 0. Click OK.)
  5. Put the cursor in the first cell in the new column that pairs with a cell in the hh:mm column. In my example, that was C3, which pairs with B3.
  6. Type =B3*1440 in the formula bar, then press Enter to convert the hours and minutes into minutes.
  7. Click in the C3 cell and ‘grab’ the bottom right handle of the cell marker (it turns to a + sign when you’ve grabbed it correctly) and drag it down the other cells in column C. (See below for how to apply it to ALL cells in the column.)

  8. When you release the mouse, all those cells you dragged this formula over will be converted to minutes and seconds.

To apply this formula to the entire column:

  1. Copy (Ctrl+C) the result in the first cell with the formula (C3 in my example).
  2. Select the entire column (column C in my example) by selecting the column header.
  3. Paste (Ctrl+V).
  4. You’ll have to rename the column back to Minutes, but you’ll have that formula now applied to every row of your spreadsheet for that column.

These sites helped me figure out what to do:

See also:

[Links last checked August 2017]