2

Sometimes, I use MS Word to draft content in Markdown, due to autosave and other helpful features. The syntax for a link is to have the readable text in square brackets immediately followed by the URL in parentheses, like this: [Super User](http://superuser.com). Commonly, I copy the URL from a browser, and go to paste it into the draft.

If I paste in Notepad, or most places in the Word document, the first characters (http...) begin immediately where the cursor was when I hit paste.

However, if I'm in Word with the cursor immediately after a ]( sequence, Word adds a space before the URL, breaking the markdown link (depending on parser strictness). It also does this if pasting text from elsewhere even in the same document, with no leading space.

How do I stop Word from doing this?

(Edition: Office 365 ProPlus, macros disabled).


Per comments from @fixit: After a paste in Word, I copied the )[ through the pasted content and pasted it in cell A1 of an Excel spreadsheet. In A2, I put the formula =RIGHT(A1,LEN(A1)-1) (equivalent to substring(1) in some other programming languages) and dragged that formula down several columns, with each row's A cell showing the same as the previous row minus the first character.

In the next column (B1) I used the formula =CODE(A1) which shows the character code for the first character in the string.

Where that space character is first (A3), the code (B3) is 32. As this is on a Windows machine, that's the ANSI character set, for which values 0-127 match ASCII, and character 32 is a space. Therefore, the character in question is a space, not some nonprintable character that Notepad ignores and Word shows as a space. Additionally, if such a character were part of the copied string, it would show up when pasted after other characters, such as ( when it is not immediately preceded by ]. However, in such cases, no space is added.

  • There's no reason why it should do that. I'm wondering if, at some point, you did such a paste and Word is now auto-correcting it for you, or something similar. Another thought, your URL copy action might be including some unexpected character. Notepad doesn't deal with it because it's a non-print character, but Word displays it as a space. It might be worth experimenting with how you select the string to copy. e.g., start the selection past the first character, paste, and see if you still get the space. (cont'd) – fixer1234 May 1 at 20:01
  • Also, copy the Word string with the extra space and put it into Excel. Use Excel's text functions to determine exactly what character that space is. – fixer1234 May 1 at 20:01
3

The Adjust sentence and word spacing automatically setting is getting in the way of your desired behavior.

It's several layers deep within the Options menu structure.

File > Options > Advanced > Cut, Copy and Paste > Smart Cut and Paste > Settings. Clear the "Adjust sentence and word spacing automatically" option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.