Pages: 1
Print
Author Topic: Adding non-breaking hyphen  (Read 6040 times)
LeoraBetesh
Member

Posts: 8


« on: March 05, 2009, 03:46:21 AM »

How do I add a non-breaking hyphen to a document in XMetaL, without using plain text view?

Do I need to set this up as a recognized value first?  If so how do I set it up?

Thanks,

Leora Betesh
Suite Solutions
Bringing the pieces together
http://www.suite-sol.com
Logged
LeoraBetesh
Member

Posts: 8


« Reply #1 on: March 05, 2009, 06:34:23 AM »

Update: I am trying out Derek's macro to add in this character.

See http://forums.xmetal.com/index.php?topic=116.0
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2183



WWW
« Reply #2 on: March 05, 2009, 05:39:06 PM »

Other Solutions:

Character Map:
If my example form is overkill (ie: you rarely need to add a particular character) you can simply copy and paste from another source or tool. Windows includes a tool called Character Map which is (when installed, which I believe it normally is now) available here (on XP):

Start > All Programs > Accessories > System Tools > Character Map

Or simply run charmap.exe" (or charmap) from a command window.

I've also heard of some 3rd party tools available that offer similar functionality, some of which try to send keystrokes to open applications so you don't have to copy and paste, however, at that point it might be nice to implement a solution like my example form so that it is a little more integrated with the product.

Alt+Numpad:
For characters that have an associated Windows Alt+Numpad shortcut (which you can find out using Character Map) you can use that as well as XMetaL Author supports those. The non-breaking-hyphen character happens to be one of those characters that does not have such a shortcut. In fact, in their great wisdom, Microsoft has decided the only "hyphen" character worthy of "soft hyphen" character, U+00AD, as worthy of having an Alt+Numpad shortcut (which happens to be Alt+0173).
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2183



WWW
« Reply #3 on: March 05, 2009, 07:54:21 PM »

According to Microsoft there are three different Alt+Numpad sequences offered by Windows (news to me -- I always thought there was only one).
Alt+Numpad: A method of entering characters by typing in the character’s decimal code with the Numeric Pad keys (Num Lock turned on). In Windows:
    * Alt+<xxx>, where xxx is the decimal value of a code point, generates an OEM-encoded character.
    * Alt+<0xxx>, where xxx is the decimal value of a code point, generates a Windows-encoded character.
    * Alt+<+>+<xxxx>, where xxxx is the hexadecimal Unicode code point, generates a Unicode-encoded (UTF-16) character.

The following article attempts to actually describe their usage:
http://www.irongeek.com/alt-numpad-ascii-key-combos-and-chart.html
Logged
ghkrause
Member

Posts: 62


« Reply #4 on: March 06, 2009, 03:05:37 AM »

I am surprised no one offered a short macro, yet, to just insert a single character. In XMetaL Author this macro can be assigned to a shortcut, menu and a toolbar icon.
Something like this should work (not tested!!)
<!DOCTYPE MACROS SYSTEM "macros.dtd">
<MACROS>
<MACRO name="InsertNonBreakingHyphen" hide="false" lang="JScript" id="" key="Ctrl+Alt+H"><![CDATA[
  if(Documents.Count==0) {
    Application.Alert( "No Document is currently Open." ); return;
  } else if (Selection.CanInsertText) {
    Selection.Text = String.fromCharCode(173); // Replace 173 with decimal unicode
  } else {
    ActiveDocument.Host.Alert("Cannot insert text here!");
  }
]]></MACRO>
</MACROS>

Store the code in a file with .mcr type in Startup folder and restart XMetaL Author. Ctrl+Alt+H will enter the character defined in the code.
**** DISCLAIMER: Code is not tested but given for reference only. ****
Logged

Gunnar H. Krause, TechDoc Manager, Nuremberg Area, Germany
dcramer
Member

Posts: 120


« Reply #5 on: March 06, 2009, 05:30:25 AM »

Yet another approach would be to define an entity in your DTD or internal subset (<!ENTITY nbsp "#160">) and use Insert->Entity Reference to add &nbsp; to your doc.

David
Logged

David Cramer
Technical Writer
Motive, an Alcatel-Lucent Company
Pages: 1
Print
Jump to: