General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Adding non-breaking hyphen

  • LeoraBetesh

    Adding non-breaking hyphen

    Participants 4
    Replies 5
    Last Activity 13 years, 3 months ago

    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

    Reply

    LeoraBetesh

    Reply to: Adding non-breaking hyphen

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

    See http://forums.xmetal.com/index.php?topic=116.0

    Reply

    Derek Read

    Reply to: Adding non-breaking hyphen

    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).

    Reply

    Derek Read

    Reply to: Adding non-breaking hyphen

    According to Microsoft there are three different Alt+Numpad sequences offered by Windows (news to me — I always thought there was only one).
    [quote=http://www.microsoft.com/globaldev/reference/glossary.mspx]
    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+, 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+<+>+, where xxxx is the hexadecimal Unicode code point, generates a Unicode-encoded (UTF-16) character.

    The following article attempts to actually describe their usage:
    [url=http://www.irongeek.com/alt-numpad-ascii-key-combos-and-chart.html]http://www.irongeek.com/alt-numpad-ascii-key-combos-and-chart.html[/url]

    Reply

    ghkrause

    Reply to: Adding non-breaking hyphen

    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!!)


      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!”);
      }
    ]]>


    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. ****

    Reply

    dcramer

    Reply to: Adding non-breaking hyphen

    Yet another approach would be to define an entity in your DTD or internal subset () and use Insert->Entity Reference to add to your doc.

    David

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support