Typing glyphs: Difference between revisions

Jump to navigation Jump to search
4,229 bytes added ,  12:20, 29 January 2023
m
m (Alternative Dvorak keyboard layouts)
Tags: Mobile edit Mobile web edit
(24 intermediate revisions by 9 users not shown)
Line 4: Line 4:
== Hardware ==
== Hardware ==


A couple of keyboards are being sold with APL symbols pre-printed onto the key caps:
Once the keyboard map is configured to one's liking, it may be beneficial (especially for new users learning APL) to have a keyboard with APL symbols. There are a few solutions to this, such as purchasing a dedicated desktop keyboard, key caps for mechanical keyboards, or a keyboard decal.


* Dyalog sells [https://www.dyalog.com/apl-font-keyboard.htm#mainContent US English, UK English, Danish and German keyboards].
{| class=wikitable
 
! Item !! Type !! Layout !! Languages !! Seller
* Unicomp sells both [https://www.amazon.com/Unicomp-Classic-Buckling-Spring-Keyboard/dp/B01M7V3M61/ref=sr_1_8 entire keyboards] and [https://www.pckeyboard.com/page/product/USAPLSET separate key caps] for their keyboard range.
|-
! rowspan=2 | Keyboard
| [[wikipedia:Model_M_keyboard|Model M]] || [[Dyalog APL|Dyalog]] || 🇺🇸 || [https://www.amazon.com/Unicomp-Classic-Buckling-Spring-Keyboard/dp/B01M7V3M61/ref=sr_1_8 Amazon].
|-
| [[wikipedia:Cherry (company)|Cherry]] || Dyalog || 🇺🇸 🇬🇧 🇩🇪 🇩🇰 || [https://www.dyalog.com/apl-font-keyboard.htm#mainContent Dyalog]
|-
! rowspan=3 | Key caps
| Model M || Dyalog || 🇺🇸 ||[https://www.pckeyboard.com/page/product/USAPLSET Unicomp]
|-
| Cherry || [[APL2]] || 🇺🇸 || [https://mykeyboard.eu/catalogue/pbt-crp-r4-alphas-apl_3957/ mykeyboard.eu]
|-
| Cherry || Dyalog || 🇺🇸 || [https://novelkeys.com/products/cherry-olivia?variant=43001363431591 NovelKeys]
|-
! Key stickers
| any || Dyalog || 🇺🇸 || [https://www.tindie.com/products/russtopia/apl-keyboard-symbol-sticker-set/ Tindie]
|}


Note that these devices only are visual modifications on regular keyboards; they do not automatically enable entry of APL glyphs into software. For this, one of the below methods is required.
Note that these devices only are visual modifications on regular keyboards; they do not automatically enable entry of APL glyphs into software. For this, one of the below methods is required.
Keyboard stickers are available for the Dyalog US layout:
* Tindie sells an [https://www.tindie.com/products/russtopia/apl-keyboard-symbol-sticker-set/ APL Keyboard Symbol Sticker Set]


== By platform ==
== By platform ==
Line 21: Line 32:
=== Web ===
=== 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.
* [[Adám Brudzewsky]]'s [https://abrudz.github.io/lb/apl  in-browser language bar] adds APL keyboard functionality to most web pages on demand.
 
* [https://daveremba.com/public/apl_vk_demo/  APL VK] is a virtual keyboard for the APL Language for modern mobile devices. 
You can add this to your own web page to provide a means to enter APL symbols into a web based form or editor.
It is similar to the APL language bar but is optimized for mobile devices.  This is work in progress.


=== Text editors ===
=== Text editors ===
 
{{Main|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.
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 ===
=== Linux ===
{{Main|Typing glyphs on Linux}}
{{Main|Typing glyphs on Linux}}


Most Linux distributions released after mid-2012 have Dyalog keyboard support included with the distribution.
* Most Linux distributions released after mid-2012 have Dyalog shifting-key support included with the distribution.
 
* [https://github.com/secwang/espanso-apl-keyboard espanso-apl-keyboard] provides text replacement entry.


[[File:Array Hacker's Keyboard.png|thumb|right|Array Hacker's Keyboard]]
[[File:Array Hacker's Keyboard.png|thumb|right|Array Hacker's Keyboard]]
Line 44: Line 61:
* [[Adám Brudzewsky]] has [https://github.com/abrudz/Kbd various keyboard English layouts for Windows], which allow <kbd>AltGr</kbd> as shifting key, <kbd>`</kbd> as prefix key, or ASCII symbol composition.
* [[Adám Brudzewsky]] has [https://github.com/abrudz/Kbd various keyboard English layouts for Windows], which allow <kbd>AltGr</kbd> as shifting key, <kbd>`</kbd> as prefix key, or ASCII symbol composition.


* Lilith Lovelace offers [https://github.com/awagga/DvorakAPL a number of alternative Dvorak keyboard layouts for Windows], which adopt the functionality of Adám's layouts.
* [[Fawn Locke]] offers [https://github.com/awagga/DvorakAPL a number of alternative Dvorak keyboard layouts for Windows], which adopt the functionality of Adám's layouts.
 
* [https://github.com/secwang/espanso-apl-keyboard espanso-apl-keyboard] provides text replacement entry.


* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>. Unless unselected, this [[wikipedia:Input_method|IME]] is installed by default with [[Dyalog APL]]:<br>[[File:Dyalog_APL_Installer.png|frameless|Dyalog APL IME selected in installer]]
* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>. Unless unselected, this [[wikipedia:Input_method|IME]] is installed by default with [[Dyalog APL]]:<br>[[File:Dyalog_APL_Installer.png|frameless|Dyalog APL IME selected in installer]]
* e-sushi has  [https://github.com/e-sushi/aplhotstrings/tree/main an AutoHotkey script] that allows ASCII composition.
==== Troubleshooting ====
Installation of the Dyalog Unicode IME can cause so many layouts to be installed that they get in the way when switching layouts. However, the unneeded layouts can be removed through editing the registry<ref>Chan, Vince. [https://forums.dyalog.com/viewtopic.php?f=14&t=1815&p=7164#p7164 How to remove Dyalog APL IME from various languages (MS WIN)]. Dyalog Forums. November 3, 2021.</ref>


=== macOS ===
=== macOS ===
* [https://github.com/secwang/espanso-apl-keyboard espanso-apl-keyboard] provides text replacement entry.
To enable these keyboard key mappings on [[wikipedia:macOS|macOS]], the appropriate <code>.keylayout</code> files for your locale must be downloaded and installed in the <code>/Library/Keyboard Layouts</code> directory:
To enable these keyboard key mappings on [[wikipedia:macOS|macOS]], the appropriate <code>.keylayout</code> files for your locale must be downloaded and installed in the <code>/Library/Keyboard Layouts</code> directory:
* [[Dyalog Ltd.]] provides keyboard layouts for [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltDK.zip Danish], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltIT.zip Finnish], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltIT.zip Italian], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltUK.zip British], and [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltUS.zip American].  
* [[Dyalog Ltd.]] provides keyboard layouts for [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltDK.zip Danish], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltIT.zip Finnish], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltIT.zip Italian], [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltUK.zip British], and [https://www.dyalog.com/uploads/files/download.php?file=DyalogAltUS.zip American].  
* LdBeth provides a keyboard layout for [https://github.com/LdBeth/APL-JIS Japanese (JIS)].
* LdBeth provides a keyboard layout for [https://github.com/LdBeth/APL-JIS Japanese (JIS)].
* [https://aplwiki.com/wiki/Typing_glyphs#ASCII_symbol_composition ASCII symbol composition] US and UK layouts are available from [https://github.com/abrudz/kbd#ascii-symbol-composition-layouts github.com/abrudz/kbd].
=== iOS ===
* ohAitch's [https://github.com/ohAitch/APLiOS APLiOS], aimed primarily at iPadOS, provides a number bar and APL symbol layers.
* [https://github.com/gitonthescene/APLKeyboard APLKeyboard] is built with [http://omz-software.com/pythonista/ Pythonista's] keyboard extension.  The keys are a bit small but it's functional.


== By method ==
== By method ==
Line 77: Line 113:
=== Shifting key ===
=== Shifting key ===


It is quite common to use <kbd>Ctrl</kbd> or <kbd>Alt</kbd> or <kbd>AltGr</kbd> (right-side <kbd>Alt</kbd>) as an additional shifting key. For example, <kbd>AltGr</kbd>+<kbd>4</kbd> would give <source lang=apl inline>≤</source> while <kbd>AltGr</kbd>+<kbd>Shift</kbd>+<kbd>4</kbd> would give <source lang=apl inline>⍋</source>.
It is quite common to use <kbd>Ctrl</kbd> or <kbd>Alt</kbd> or <kbd>AltGr</kbd> (right-side <kbd>Alt</kbd>) as an additional shifting key. For example, <kbd>AltGr</kbd>+<kbd>4</kbd> would give <syntaxhighlight lang=apl inline>≤</syntaxhighlight> while <kbd>AltGr</kbd>+<kbd>Shift</kbd>+<kbd>4</kbd> would give <syntaxhighlight lang=apl inline>⍋</syntaxhighlight>.


* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>
* The [https://www.dyalog.com/apl-font-keyboard.htm#tab-1 Dyalog Unicode IME] uses <kbd>Ctrl</kbd>
Line 94: Line 130:


* [[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>.
* Custom .XCompose files can be used on Linux as described in [https://aplwiki.com/wiki/Typing_glyphs_on_Linux#XCompose_(backtick/prefix/dead_key) the page Typing Glyphs on Linux].


[[File:RIDE keyword lookup.png|thumb|right|RIDE keyword lookup]]
[[File:RIDE keyword lookup.png|thumb|right|RIDE keyword lookup]]
Line 103: Line 141:
=== Keyword look-up ===
=== Keyword look-up ===


* The [https://github.com/Dyalog/ride/releases/latest Dyalog RIDE] (Remote Integrated Development Environment) allows hitting the prefix key (<kbd>`</kbd> 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. <kbd>`</kbd>,<kbd>`</kbd>,<kbd>d</kbd>,<kbd>i</kbd>,<kbd>v</kbd>,<kbd>Tab↹</kbd> inserts <source lang=apl inline>÷</source>.
The [https://github.com/Dyalog/ride/releases/latest Dyalog RIDE] (Remote Integrated Development Environment) allows hitting the prefix key (<kbd>`</kbd> 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. <kbd>`</kbd>,<kbd>`</kbd>,<kbd>d</kbd>,<kbd>i</kbd>,<kbd>v</kbd>,<kbd>Tab↹</kbd> inserts <syntaxhighlight lang=apl inline>÷</syntaxhighlight>.


=== ASCII symbol composition ===
=== ASCII symbol composition ===


* 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>.
Many APL glyphs can be approximated by overlaying or juxtaposing two ASCII characters. [[ngn/apl]]'s scripted demo interface, [https://abrudz.github.io/lb/apl Adám Brudzewsky's in-browser language bar], and [[TryAPL]]'s web interface 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 <syntaxhighlight lang=apl inline>←</syntaxhighlight> and <kbd>T</kbd>,<kbd>o</kbd>,<kbd>Tab↹</kbd> will insert <syntaxhighlight lang=apl inline>⍕</syntaxhighlight>.
 
For Windows users, e-sushi has  [https://github.com/e-sushi/aplhotstrings/tree/main an AutoHotkey script] that allows such composition.
 
=== Text replacement ===
 
[https://github.com/espanso/espanso Espanso] allows typing a pattern which is then immediately replaced with something else. This can be used in various ways to type APL glyphs without conflicting with application or operating system keyboard shortcuts. [https://github.com/secwang/espanso-apl-keyboard espanso-apl-keyboard] is an Espanso configuration that emulates prefix key, so for example typing pressing <kbd>`</kbd>,<kbd>e</kbd> too type <code>`e</code> will be end up producing the <syntaxhighlight lang=apl inline>∊</syntaxhighlight> glyph.


[[File:NARS2000 language bar.png|thumb|right|NARS2000 language bar]]
[[File:NARS2000 language bar.png|thumb|right|NARS2000 language bar]]
Line 124: Line 168:
To check your setup is fully functional you can try compiling the following template:
To check your setup is fully functional you can try compiling the following template:
[[File:LaTeX APL template.png|thumb|right|Screenshot of the typeset document]]
[[File:LaTeX APL template.png|thumb|right|Screenshot of the typeset document]]
<source lang=latex>
<syntaxhighlight lang=latex>
\documentclass[11pt]{article}
\documentclass[11pt]{article}


Line 138: Line 182:


\end{document}
\end{document}
</source>
</syntaxhighlight>


Depending on whether you want the whole document to use the APL font or not, you may remove the command to set the main font. If you do so, APL glyphs will be rendered correctly inside code listings and similar environments, but not in the main body of the document.
Depending on whether you want the whole document to use the APL font or not, you may remove the command to set the main font. If you do so, APL glyphs will be rendered correctly inside code listings and similar environments, but not in the main body of the document.
Line 145: Line 189:


LuaLaTeX and XeLaTeX can use the [https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings ''listings'' package] to include APL source with the following document preamble:<ref>Baker, John D. [https://analyzethedatanotthedrivel.org/2011/08/15/typesetting-utf8-apl-code-with-the-latex-lstlisting-package/ Typesetting UTF8 APL code with the LaTeX lstlisting package]. Analyze the Data not the Drivel. August 15, 2011.</ref>
LuaLaTeX and XeLaTeX can use the [https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings ''listings'' package] to include APL source with the following document preamble:<ref>Baker, John D. [https://analyzethedatanotthedrivel.org/2011/08/15/typesetting-utf8-apl-code-with-the-latex-lstlisting-package/ Typesetting UTF8 APL code with the LaTeX lstlisting package]. Analyze the Data not the Drivel. August 15, 2011.</ref>
<source lang=latex>
<syntaxhighlight lang=latex>
% set lstlisting to accept UTF8 APL text
% set lstlisting to accept UTF8 APL text
\makeatletter
\makeatletter
Line 172: Line 216:
\lst@RestoreCatcodes
\lst@RestoreCatcodes
\makeatother
\makeatother
</source>
</syntaxhighlight>
 
=== plainTeX ===
 
LdBeth has made a [https://ldbeth.sdf.org/aplfont.html Type1 version] of [https://github.com/rbanffy/3270font 3270 font] with APL support, suitable for traditional TeX implementations that cannot directly use TTF/OTF fonts.
 
[[File:3270 APL font sample.png|thumb|right|Screenshot of the typeset document]]
<syntaxhighlight lang=latex>
\input apldef.tex
 
\font\apl=3270
 
\apl
 
1234567890{\rm Good?}\NG1+2-3{\rm Mixing some roman}
 
I just want some \IS +-\ML\DV\ST\LG\DQ\LO{}!?\ |\CE\FL\DE\EN\LK\RK\ =\NE\LE<>\GE\EU\SE
 
\AD\OR\NA\NO\ \UA\DA\RU\LU\SS\SQ\GU\GD\ \IO\UI\EP\UE\UU\DU\NT\ /\BL\CS\CB\ ,\BC\RO\RV\CR\TR
 
\DD\RR\PP.\SO\RN\OV{}@\ \QQ\BX\CQ\EQ\MQ\IB\XQ\FM\ \DM\LM\GO\OM\AM\DL\&
 
\NG\NL
 
\obeylines\DL S\IS SUM N;I
S\IS I\IS 0
\GO (N<I\IS I+1)/0
S\IS S+I\ST 2
\GO 2
\DL
\bye
</syntaxhighlight>


== References ==
== References ==

Navigation menu