Typing glyphs: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Add MATE keyboard configuration)
(move typeball to fonts)
(9 intermediate revisions by 3 users not shown)
Line 3: Line 3:
== How to Set up an APL Keyboard ==
== How to Set up an APL Keyboard ==


=== Android ===
[[File:Adám Brudzewsky's in-browser language bar.png|thumb|right|The in-browser language bar]]
=== Web ===


Dzaima's [https://github.com/dzaima/hackerskeyboard Hacker's Keyboard + APL language] uses a [[wikipedia:Pointing_device_gesture#Touchpad_and_touchscreen_gestures|long-press]] to access APL glyphs.
[[Adám Brudzewsky]]'s [https://abrudz.github.io/lb/apl  in-browser language bar] adds APL keyboard functionality to most web pages on demand.


=== Linux ===
=== Text editors ===


[[Geoff Streeter]] authored a paper, [https://www.dyalog.com/uploads/conference/dyalog10/presentations/P19_Streeter_Keyboards.pdf Supporting APL keyboards on Linux], which was presented at the [https://aplwiki.com/wiki/Dyalog_user_meeting#Dyalog_.2710 Dyalog '10] user meeting. In this paper, Geoff details how APL keyboards can be supported in [[wikipedia:X_Window_System|X11]] using <source lang=console inline>xkb</source>, the [https://www.x.org/wiki/XKB/ X Keyboard Extension].
Keyboard layout extensions exist for several popular [[text editors]] like VS Code, Emacs and Vim. This can be an alternative, or complementary, to system-wide settings.


Most Linux distributions released after mid-2012 have [https://forums.dyalog.com/viewtopic.php?f=20&t=210 Dyalog keyboard support] included with the distribution.
=== Linux ===
{{Main|Typing glyphs on Linux}}


==== setxkbmap ====
Most Linux distributions released after mid-2012 have Dyalog keyboard support included with the distribution.


The simplest way to set up an APL keyboard on Linux is with the following <source lang=console inline>setxkbmap</source> command. Enter the following in your terminal emulator of choice:
[[File:Hacker's Keyboard + APL language.png|thumb|right|Hacker's Keyboard + APL language]]
 
=== Android ===
<source lang=console>
setxkbmap -layout us,apl -variant ,dyalog -option grp:switch
</source>
 
An explanation:
 
* <source lang=console inline>-layout us,apl</source> assigns <source lang=console inline>us</source> ([[wikipedia:American_English|U.S. English]]) to be the primary layout, whereas <source lang=console inline>apl</source> is secondary
 
* <source lang=console inline>-option grp:switch</source> assigns <kbd>Right Alt</kbd> to switch to the secondary <source lang=console inline>apl</source> layout when it is pressed, otherwise <source lang=console inline>us</source> is used
 
* <source lang=console inline>-variant ,dyalog</source> assigns the [[Dyalog APL]] variant to the <source lang=console inline>apl</source> layout which contains modifiations unique to the Dyalog language ('''Note the preceding comma''')
 
A full list of keys that can be used to switch layouts is included in <source lang=console inline>/usr/share/X11/xkb/rules/evdev.lst</source> under the <source lang=console inline>option</source> category.
 
 
'''Note:''' these changes are not permanent; the user will have to select one of a myriad of methods to run the command on startup. Alternatively, if they use one of the [[wikipedia:Desktop_environment|desktop environments]] listed below, they can follow those instructions.
 
==== Gnome 3 ====
 
==== LXDE ====
 
Prepend an <source lang=console inline>@</source> to the <source lang=console inline>setxkbmap</source> command from above, like shown:
 
<source lang=console>
@setxkbmap -layout us,apl -variant ,dyalog -option grp:switch
</source>
 
and add it as a line in your user's LXDE <source lang=console inline>auostart</source> file, located at:
 
<source lang=console>
~/.config/lxsession/LXDE/autostart
</source>
 
For Lubuntu versions up to and including 18.04 (before the LXQt split), the location of <source lang=console inline>autostart</source> is <source lang=console inline>~/.config/lxsession/Lubuntu/autostart</source>.
 
==== LXQt ====
 
===== GUI =====
 
From your LXQt panel, navigate to ''Preferences'' → ''LXQt Settings'' → ''Session Settings''; alternatively, enter <source lang=console inline>lxqt-config-session</source> in your terminal emulator. You will be greeted with the following window:
 
[[File:Lxqt-session-settings.png|frameless|LXQt Autostart menu of Session Settings window]]
 
Select the <source lang=console inline>LXQt Autostart</source> dropdown (it will be highlighted as shown above) and click the ''Add'' button to display the following pop-up window:
 
[[File:Lxqt-add-autostart.png|frameless|LXQt add a new autostart menu item]]
 
Name it whatever you want, and enter a <source lang=console inline>setxkbmap</source> command that suits your taste. Shown above is the same command as detailed [[Typing glyphs#setxkbmap| in the setxkbmap section]].
 
===== Terminal =====
 
The above GUI approach merely creates a <source lang=console inline>.desktop</source> file in the user's <source lang=console inline>~/.config/autostart</source>. Create your own file in the <source lang=console inline>autostart</source> directory whose contents are as follows, to replicate the functionality achieved through the GUI:
 
<source lang=ini>
[Desktop Entry]
Exec=setxkbmap -layout us,apl -variant ,dyalog -option grp:switch
Name=apl-keyboard
OnlyShowIn=LXQt;
Type=Application
Version=1.0
</source>
 
==== MATE ====
 
===== GUI =====
 
Open your MATE menu (in the top-left corner of a default environment) and select ''Control Center'' at the bottom of the window:
 
[[File:Mate-kbb-setup-1.png|frameless|Launch the Control Center from the MATE menu]]
 
Scroll down through the main window, and under the ''Personal'' category, select ''Startup Applications'':
 
[[File:Mate-kbb-setup-2.png|frameless|Scroll down to the Startup Applications option]]
 
Click the ''Add'' button on the right-hand side:
 
[[File:Mate-kbb-setup-3.png|frameless|Click 'Add' to add a new startup command]]
 
Provide a name, enter your <code>setxkbmap</code> command, and click ''Add'' when finished:
 
[[File:Mate-kbb-setup-4.png|frameless|Enter the setxkbmap command you wish to use]]
 
===== Terminal =====
 
Navigate to <code>~/.config/autostart</code> and create a <code>.desktop</code> with any name that will help you remember its function.
 
Add the following to the contents of your file, customizing to suit your needs:
 
<source lang=ini>
[Desktop Entry]
Type=Application
Exec=setxkbmap -layout us,apl -variant ,dyalog -option grp:switch
Hidden=false
X-MATE-Autostart-enabled=true
Name[en_US]=apl-keyboard
Name=apl-keyboard
Comment[en_US]=
Comment=
X-MATE-Autostart-Delay=0
</source>
 
This is similar to the process for other methods, such as LXQt, but has some MATE-specific configuration as can be seen above.
 
==== Xfce ====
 
A tutorial specific to Xfce's config files can be found [https://github.com/hashslingrz/apl-keyboard-xfce at this GitHub repository].
 
=== Text editors ===


Keyboard layout extensions exist for several popular [[text editors]] like VS Code, Emacs and Vim. This can be an alternative, or complementary, to system-wide settings.
dzaima's [https://github.com/dzaima/hackerskeyboard Hacker's Keyboard + APL language] uses a [[wikipedia:Pointing_device_gesture#Touchpad_and_touchscreen_gestures|long-press]] to access APL glyphs.
 
=== Web ===
 
[[Adám Brudzewsky]]'s [https://abrudz.github.io/lb/apl  in-browser language bar] adds APL keyboard functionality to most web pages on demand.


=== Windows ===
=== Windows ===
Line 136: Line 26:
* [[Adám Brudzewsky]]'s [https://github.com/abrudz/Kbd keyboard layouts for Windows], which uses <kbd>AltGr</kbd>.
* [[Adám Brudzewsky]]'s [https://github.com/abrudz/Kbd keyboard layouts for Windows], which uses <kbd>AltGr</kbd>.


* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>. It is also possible to install the [[wikipedia:Input_method|IME]] alongside a regular [[Dyalog APL]] installation:
* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>. It is also possible to install the [[wikipedia:Input_method|IME]] alongside a regular [[Dyalog APL]] installation:<br>[[File:Dyalog_APL_Installer.png|frameless|Dyalog APL IME selected in installer]]
[[File:Dyalog_APL_Installer.png|frameless|Dyalog APL IME selected in installer]]


== Approaches to Layout and Input ==
== Approaches to Layout and Input ==
Line 181: Line 70:
* [[Adám Brudzewsky]]'s [https://abrudz.github.io/lb/apl in-browser language bar] recognises all the following as prefix keys: <kbd>`</kbd>, <kbd>½</kbd>, <kbd>²</kbd>, <kbd>^</kbd>, <kbd><s>º</s></kbd>, <kbd>§</kbd>, <kbd>ù</kbd>, <kbd>µ</kbd>, <kbd>°</kbd>.
* [[Adám Brudzewsky]]'s [https://abrudz.github.io/lb/apl in-browser language bar] recognises all the following as prefix keys: <kbd>`</kbd>, <kbd>½</kbd>, <kbd>²</kbd>, <kbd>^</kbd>, <kbd><s>º</s></kbd>, <kbd>§</kbd>, <kbd>ù</kbd>, <kbd>µ</kbd>, <kbd>°</kbd>.


[[File:Dyalog US keyboard.jpg|thumb|right|US keyboard with [[Dyalog APL]] glyphs]]
[[File:RIDE keyword lookup.png|thumb|right|RIDE keyword lookup]]
 
=== Keyword look-up ===
=== Keyword look-up ===


Line 189: Line 77:
=== ASCII symbol combination ===
=== ASCII symbol combination ===


* Many APL glyphs can be approximated by overlaying or juxtaposing two ASCII characters. [[ngn/apl]]'s scripted demo interface and [https://abrudz.github.io/lb/apl Adám Brudzewsky's in-browser language bar] allow such a pair of characters and hitting the Tab key to replace them with the corresponding APL character. For example, <kbd><</kbd>,<kbd>-</kbd>,<kbd>Tab↹</kbd> will insert <source lang=apl inline>←</source> and <kbd>T</kbd>,<kbd>o</kbd>,<kbd>Tab↹</kbd> will insert <source lang=apl inline>⍕</source>.
* Many APL glyphs can be approximated by overlaying or juxtaposing two ASCII characters. [[ngn/apl]]'s scripted demo interface and [https://abrudz.github.io/lb/apl Adám Brudzewsky's in-browser language bar] allow such a pair of characters and hitting the <kbd>Tab↹</kbd> key to replace them with the corresponding APL character. For example, <kbd><</kbd>,<kbd>-</kbd>,<kbd>Tab↹</kbd> will insert <source lang=apl inline>←</source> and <kbd>T</kbd>,<kbd>o</kbd>,<kbd>Tab↹</kbd> will insert <source lang=apl inline>⍕</source>.


[[File:NARS2000 language bar.png|thumb|right|NARS2000 language bar]]
=== On-screen language bar ===
=== On-screen language bar ===


Line 197: Line 86:
* [[Dyalog APL]], [[NARS2000]], [[APL2]] and [[ngn/apl]]'s scripted demo interface  all have this feature.
* [[Dyalog APL]], [[NARS2000]], [[APL2]] and [[ngn/apl]]'s scripted demo interface  all have this feature.


[[File:Dyalog US keyboard.jpg|thumb|right|US keyboard with [[Dyalog APL]] glyphs]]
== Hardware ==
== Hardware ==
A couple of keyboards are being sold with APL symbols pre-printed onto the key caps:
A couple of keyboards are being sold with APL symbols pre-printed onto the key caps:

Revision as of 22:46, 4 June 2020

APL uses a large range of special graphic symbols to represent most functions and operators. While keyboard mappings become memorized over time, entering APL characters can frustrate the beginner. However, a study involving high school students found that typing and using APL characters did not hinder the students in any measurable way. There are several convenient ways to enter the glyphs.

How to Set up an APL Keyboard

The in-browser language bar

Web

Adám Brudzewsky's in-browser language bar adds APL keyboard functionality to most web pages on demand.

Text editors

Keyboard layout extensions exist for several popular text editors like VS Code, Emacs and Vim. This can be an alternative, or complementary, to system-wide settings.

Linux

Main article: Typing glyphs on Linux

Most Linux distributions released after mid-2012 have Dyalog keyboard support included with the distribution.

Hacker's Keyboard + APL language

Android

dzaima's Hacker's Keyboard + APL language uses a long-press to access APL glyphs.

Windows

Approaches to Layout and Input

Most of today's APLs use a mapping which derives from the original APL\360 terminals' keyboard layout. For example, Dyalog APL's standard US English layout for is as follows:

┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐
│~ ⌺ │! ⌶ │@ ⍫ │# ⍒ │$ ⍋ │% ⌽ │^ ⍉ │& ⊖ │* ⍟ │( ⍱ │) ⍲ │_ ! │+ ⌹ │Backspace│
│` ⋄ │1 ¨ │2 ¯ │3 < │4 ≤ │5 = │6 ≥ │7 > │8 ≠ │9 ∨ │0 ∧ │- × │= ÷ │         │
├────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬──────┤
│Tab    │Q   │W   │E ⍷ │R   │T ⍨ │Y   │U   │I ⍸ │O ⍥ │P ⍣ │{ ⍞ │} ⍬ │| ⊣   │
│       │q ? │w ⍵ │e ∊ │r ⍴ │t ~ │y ↑ │u ↓ │i ⍳ │o ○ │p * │[ ← │] → │\ ⊢   │
├───────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴──────┤
│Caps    │A   │S   │D   │F   │G   │H   │J ⍤ │K ⌸ │L ⌷ │: ≡ │" ≢ │Enter     │
│Lock    │a ⍺ │s ⌈ │d ⌊ │f _ │g ∇ │h ∆ │j ∘ │k ' │l ⎕ │; ⍎ │' ⍕ │          │
├────────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──────────┤
│Shift      │Z ⊆ │X   │C   │V   │B   │N   │M   │< ⍪ │> ⍙ │? ⍠ │Shift       │
│           │z ⊂ │x ⊃ │c ∩ │v ∪ │b ⊥ │n ⊤ │m | │, ⍝ │. ⍀ │/ ⌿ │            │
└───────────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────────────┘

Additional charts for other layouts are available.

There are multiple ways to access the glyphs associated with a particular key.

Shifting key

It is quite common to use Ctrl or Alt or AltGr (right-side Alt) as an additional shifting key. For example, AltGr+AltGr+4 would give while AltGr+Shift+4 would give .

  • APLX uses AltGr with an option to also use Alt

Prefix key

A prefix key is a special key or character which is entered immediately before typing the corresponding key.

  • TryAPL and ngn/apl's scripted demo interface support ` as prefix key.
  • The Dyalog Unicode IME and the Dyalog RIDE (Remote Integrated Development Environment) uses ` by default, but allows choosing any key as prefix key.
RIDE keyword lookup

Keyword look-up

  • The Dyalog RIDE (Remote Integrated Development Environment) allows hitting the prefix key (` by default, but configurable) twice, followed by the (beginning of the) name of a symbol or a functionality. It then displays a drop-down of choices with arrow keys to indicate choice and the Tab key to insert the symbol. E.g. `,`,d,i,v,Tab↹ inserts ÷.

ASCII symbol combination

  • Many APL glyphs can be approximated by overlaying or juxtaposing two ASCII characters. ngn/apl's scripted demo interface and Adám Brudzewsky's in-browser language bar allow such a pair of characters and hitting the Tab↹ key to replace them with the corresponding APL character. For example, <,-,Tab↹ will insert and T,o,Tab↹ will insert .
NARS2000 language bar

On-screen language bar

Several APL IDEs allow the display of a toolbar with a button for each APL glyph:

US keyboard with Dyalog APL glyphs

Hardware

A couple of keyboards are being sold with APL symbols pre-printed onto the key caps:


APL development [edit]
Interface SessionTyping glyphs (on Linux) ∙ FontsText editors
Publications IntroductionsLearning resourcesSimple examplesAdvanced examplesMnemonicsISO 8485:1989ISO/IEC 13751:2001A Dictionary of APLCase studiesDocumentation suitesBooksPapersVideosAPL Quote QuadVector journalTerminology (Chinese, German) ∙ Neural networksError trapping with Dyalog APL (in forms)
Sharing code Backwards compatibilityAPLcartAPLTreeAPL-CationDfns workspaceTatinCider
Implementation ResourcesOpen-sourceMagic functionPerformanceAPL hardware
Developers Timeline of corporationsAPL2000DyalogIBMIPSASTSC
APL glyphs [edit]
Information GlyphTyping glyphs (on Linux) ∙ UnicodeFontsMnemonicsOverstrikesMigration level
Individual glyphs Jot () ∙ Right Shoe () ∙ Up Arrow () ∙ Zilde () ∙ High minus (¯) ∙ Dot (.) ∙ Del ()