commit fd7490762d6248bb4ca7120fe97b28d96496d9d3
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Aug 9 15:05:19 2018 +0200

    Support key symbols via menukeys package
---
 lib/chkconfig.ltx    |    1 +
 lib/unicodesymbols   |   28 ++++++++++++++--------------
 src/BufferParams.cpp |    9 +++++++--
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index be29720..401406e 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -466,6 +466,7 @@
 \TestPackage{mdbch}
 \TestPackage{mdput}
 \TestPackage{mdugm}
+\TestPackage{menukeys}
 \TestPackage{MinionPro}
 \TestFont[rzmnr]{minion2newtx}
 \TestPackage{newtxmath}
diff --git a/lib/unicodesymbols b/lib/unicodesymbols
index ba2afdf..393ab47 100644
--- a/lib/unicodesymbols
+++ b/lib/unicodesymbols
@@ -17,7 +17,6 @@
 # You can use development/tools/unicodesymbols.py to add stubs for more
 # symbols.
 # Do only add commands that give correct output, no hacks that look "similar".
-# TODO: fix "missing Qt keysequences (MacSpecialKey)" hacks (search for "Qt::")
 # Commands that modify other parts of the text should not be added either.
 # For this reason, all commands requiring txfonts, pxfonts, fourier, mathdesign
 # and MnSymbol are commented out (these packages switch to fonts like times or
@@ -2052,7 +2051,7 @@
 0x21b6 ""                         "" "force=utf8;utf8x" "\\curvearrowleft" 
"amssymb" # ANTICLOCKWISE TOP SEMICIRCLE ARROW
 0x21b7 ""                         "" "force=utf8;utf8x" "\\curvearrowright" 
"amssymb" # CLOCKWISE TOP SEMICIRCLE ARROW
 #0x21b8 ""                         "" "" "" "" # NORTH WEST ARROW TO LONG BAR
-#0x21b9 ""                         "" "" "" "" # LEFTWARDS ARROW TO BAR OVER 
RIGHTWARDS ARROW TO BAR
+0x21b9 "\\tabwin"                  "menukeys" "force" "" "" # LEFTWARDS ARROW 
TO BAR OVER RIGHTWARDS ARROW TO BAR
 0x21ba ""                         "" "force=utf8;utf8x" "\\circlearrowleft" 
"amssymb" # ANTICLOCKWISE OPEN CIRCLE ARROW
 0x21bb ""                         "" "force=utf8;utf8x" "\\circlearrowright" 
"amssymb" # CLOCKWISE OPEN CIRCLE ARROW
 0x21bc ""                         "" "force=utf8" "\\leftharpoonup" "" # 
LEFTWARDS HARPOON WITH BARB UPWARDS
@@ -2089,19 +2088,20 @@
 0x21db ""                         "" "force=utf8;utf8x" "\\Rrightarrow" 
"amssymb" # RIGHTWARDS TRIPLE ARROW
 #0x21dc ""                         "" "" "\\leftsquigarrow" "mathabx" # 
LEFTWARDS SQUIGGLE ARROW
 0x21dd ""                         "" "force=utf8;utf8x" "\\rightsquigarrow" 
"amssymb" # RIGHTWARDS SQUIGGLE ARROW
-0x21de "Option-Up Arrow"          "" "force=utf8;utf8x,notermination=text" "" 
"" #Qt::Key_PageUp, UPWARDS ARROW WITH DOUBLE STROKE = page up "\\nHuparrow" 
"boisik|stik"
-0x21df "Option-Down Arrow"        "" "force=utf8;utf8x,notermination=text" "" 
"" # Qt::Key_PageDown, DOWNWARDS ARROW WITH DOUBLE STROKE = page down 
"\\nHdownarrow" "boisik|stix"
+# FIXME Yes, these are constructed, but better than a key symbols text.
+0x21de "\\ooalign{\\textuparrow\\cr\\kern.1em\\textdblhyphen}"  "textcomp" 
"force=utf8;utf8x" "" "" #Qt::Key_PageUp, UPWARDS ARROW WITH DOUBLE STROKE = 
page up "\\nHuparrow" "boisik|stix"
+0x21df "\\ooalign{\\textdownarrow\\cr\\kern.1em\\textdblhyphen}" "textcomp" 
"force=utf8;utf8x,notermination=text" "" "" # Qt::Key_PageDown, DOWNWARDS ARROW 
WITH DOUBLE STROKE = page down "\\nHdownarrow" "boisik|stix"
 0x21e0 ""                         "" "force=utf8;utf8x" "\\dashleftarrow" 
"amssymb" # LEFTWARDS DASHED ARROW
 #0x21e1 ""                         "" "" "" "" # UPWARDS DASHED ARROW
 0x21e2 ""                         "" "force=utf8;utf8x" "\\dashrightarrow" 
"amssymb" # RIGHTWARDS DASHED ARROW
 #0x21e3 ""                         "" "" "" "" # DOWNWARDS DASHED ARROW
-0x21e4 "Shift-Tab"                "" "force=utf8;utf8x,notermination=text" "" 
"" # Qt::Key_Backtab, LEFTWARDS ARROW TO BAR = leftward tab "\\barleftarrow" 
"boisik|stix"
-0x21e5 "Tab"                      "" "force=utf8;utf8x,notermination=text" "" 
"" # Qt::Key_Tab, RIGHTWARDS ARROW TO BAR = rightward tab "\\rightarrowbar" 
"boisik|stix"
+0x21e4 "\\reflectbox{\\tabmac}"   "menukeys,graphics" "force" "" "" # 
Qt::Key_Backtab, LEFTWARDS ARROW TO BAR = leftward tab "\\barleftarrow" 
"boisik|stix"
+0x21e5 "\\tabmac"                 "menukeys" "force" "" "" # Qt::Key_Tab, 
RIGHTWARDS ARROW TO BAR = rightward tab "\\rightarrowbar" "boisik|stix"
 #0x21e6 ""                         "" "" "" "" # LEFTWARDS WHITE ARROW
-#0x21e7 ""                         "" "" "" "" # UPWARDS WHITE ARROW
+0x21e7 "\\shift"                  "menukeys" "force" "" "" # UPWARDS WHITE 
ARROW
 0x21e8 "\\pointer"                "wasysym" "force=utf8;utf8x" "" "" # 
RIGHTWARDS WHITE ARROW
 #0x21e9 ""                         "" "" "" "" # DOWNWARDS WHITE ARROW
-0x21ea "Caps Lock"                "" "force=utf8;utf8x,notermination=text" "" 
"" # Qt::Key_CapsLock, UPWARDS WHITE ARROW FROM BAR = caps lock 
"\\whitearrowupfrombar" "boisik|stix"
+0x21ea "\\capslockmac"             "menukeys" "force" "" "" # 
Qt::Key_CapsLock, UPWARDS WHITE ARROW FROM BAR = caps lock 
"\\whitearrowupfrombar" "boisik|stix"
 #0x21eb ""                         "" "" "" "" # UPWARDS WHITE ARROW ON 
PEDESTAL
 #0x21ec ""                         "" "" "" "" # UPWARDS WHITE ARROW ON 
PEDESTAL WITH HORIZONTAL BAR
 #0x21ed ""                         "" "" "" "" # UPWARDS WHITE ARROW ON 
PEDESTAL WITH VERTICAL BAR
@@ -2410,7 +2410,7 @@
 0x2315 "\\recorder"               "wasysym" "force" "" "" # TELEPHONE RECORDER
 #0x2316 ""                         "" "" "" "" # POSITION INDICATOR
 #0x2317 ""                         "" "" "" "" # VIEWDATA SQUARE
-#0x2318 ""                         "" "" "" "" # PLACE OF INTEREST SIGN
+0x2318 "\\cmdmac"                 "menukeys" "force" "" "" # PLACE OF INTEREST 
SIGN
 #0x2319 ""                         "" "" "" "" # TURNED NOT SIGN
 0x231a "\\Clocklogo"              "marvosym" "force" # WATCH
 #0x231b ""                         "" "" "" "" # HOURGLASS
@@ -2422,15 +2422,15 @@
 #0x2321 ""                         "" "" "" "" # BOTTOM HALF INTEGRAL
 0x2322 ""                         "" "force" "\\frown" "" # FROWN
 0x2323 ""                         "" "force" "\\smile" "" # SMILE
-#0x2324 ""                         "" "" "" "" # UP ARROWHEAD BETWEEN TWO 
HORIZONTAL BARS
-#0x2325 ""                         "" "" "" "" # OPTION KEY
-0x2326 "Delete"                   "" "force,notermination=text" "" "" # 
Qt::Key_Delete, ERASE TO THE RIGHT = delete to the right key
+0x2324 "\\enter"                  "menukeys" "force" "" "" # UP ARROWHEAD 
BETWEEN TWO HORIZONTAL BARS
+0x2325 "\\Altmac"                 "menukeys" "force" "" "" # OPTION KEY
+0x2326 "\\delmac"                 "menukeys" "force" "" "" # Qt::Key_Delete, 
ERASE TO THE RIGHT = delete to the right key
 0x2328 "\\Keyboard"               "marvosym" "force" # KEYBOARD
-0x232b "Backspace"                "" "force,notermination=text" "" "" # 
Qt::Key_Backspace, ERASE TO THE LEFT = delete to the left key
+0x232b "\\backdelmac"             "menukeys" "force" "" "" # 
Qt::Key_Backspace, ERASE TO THE LEFT = delete to the left key
 0x2339 ""                         "" "force" "\\APLinv" "wasysym" # APL 
FUNCTIONAL SYMBOL QUAD DIVIDE
 0x233f ""                         "" "force" "\\notslash" "wasysym" # APL 
FUNCTIONAL SYMBOL SLASH BAR
 0x2340 ""                         "" "force" "\\notbackslash" "wasysym" # APL 
FUNCTIONAL SYMBOL BACKSLASH BAR
-0x238b "Escape"                   "" "force,notermination=text" "" "" # 
Qt::Key_Escape, BROKEN CIRCLE WITH NORTHWEST ARROW = escape
+0x238b "\\escmac"                 "menukeys" "force" "" "" # Qt::Key_Escape, 
BROKEN CIRCLE WITH NORTHWEST ARROW = escape
 #
 # 79 Control Pictures
 #
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 503cc77..8245f73 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2242,8 +2242,8 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
                   << "\\makeatother\n\n";
 
        // We try to load babel late, in case it interferes with other packages.
-       // Jurabib, hyperref, varioref, bicaption and listings (bug 8995) have 
to be
-       // called after babel, though.
+       // Jurabib, hyperref, varioref, bicaption, menukeys and listings (bug 
8995)
+       // have to be called after babel, though.
        if (use_babel && !features.isRequired("jurabib")
            && !features.isRequired("hyperref")
            && !features.isRequired("varioref")
@@ -2385,6 +2385,11 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
                os << '\n';
        }
 
+       // Since menukeys uses catoptions, which does some heavy changes on 
key-value options,
+       // it is recommended to load menukeys as the last package (even after 
hyperref)
+       if (features.isRequired("menukeys"))
+               os << "\\usepackage{menukeys}\n";
+
        docstring const i18npreamble =
                features.getTClassI18nPreamble(use_babel, use_polyglossia,
                                               use_minted);

Reply via email to