Typing glyphs: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
No edit summary
Line 128: Line 128:
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.


==== listings ====
==== Listings ====


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>

Revision as of 13:35, 13 January 2021

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.

US keyboard with Dyalog APL glyphs

Hardware

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

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.

By platform

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

By method

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

Long-press

dzaima's Hacker's Keyboard + APL language reacts to a long-press, popping up a palette that allows selecting any of the APL glyphs associated with that button.

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 composition

  • 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:

LaTeX

In order to typeset APL using LaTeX, you need to be sure your LaTeX engine has full Unicode support. At the time of writing, LuaLaTeX and XeLaTeX are two of the most popular such alternatives, both included with TeX Live.

After ensuring you have a LaTeX engine that is Unicode capable, you need to make sure your .tex document is using a font that has the APL glyphs you want to type. One way to do this is through the fontspec package, as seen in the example template below.

To check your setup is fully functional you can try compiling the following template:

Screenshot of the typeset document
\documentclass[11pt]{article}

\usepackage{fontspec}
\setmainfont{APL385 Unicode}
\setmonofont{APL385 Unicode}[Scale=MatchLowercase]

\begin{document}

I just want some ← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⊆⌷⍋⍒ ⍳⍸∊⍷∪∩~ /\textbackslash⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘⍤⍥@ ⍞⎕⍠⌸⌺⌶⍎⍕ ⋄⍝→⍵⍺∇\& ¯⍬

\texttt{The ``setmonofont'' was needed because of this, otherwise ⍺⌊¯→⍬ wouldn't show properly}.

\end{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.

Listings

LuaLaTeX and XeLaTeX can use the listings package to include APL source with the following document preamble:[1]

% set lstlisting to accept UTF8 APL text
\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
 \lst@CCECUse \lst@ProcessLetter
  ^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f%
  ^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f%
  ^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af%
  ^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf%
  ^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf%
  ^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df%
  ^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef%
  ^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff%
  ^^^^20ac^^^^0153^^^^0152%
  ^^^^20a7^^^^2190^^^^2191^^^^2192^^^^2193^^^^2206^^^^2207^^^^220a%
  ^^^^2218^^^^2228^^^^2229^^^^222a^^^^2235^^^^223c^^^^2260^^^^2261%
  ^^^^2262^^^^2264^^^^2265^^^^2282^^^^2283^^^^2296^^^^22a2^^^^22a3%
  ^^^^22a4^^^^22a5^^^^22c4^^^^2308^^^^230a^^^^2336^^^^2337^^^^2339%
  ^^^^233b^^^^233d^^^^233f^^^^2340^^^^2342^^^^2347^^^^2348^^^^2349%
  ^^^^234b^^^^234e^^^^2350^^^^2352^^^^2355^^^^2357^^^^2359^^^^235d%
  ^^^^235e^^^^235f^^^^2361^^^^2362^^^^2363^^^^2364^^^^2365^^^^2368%
  ^^^^236a^^^^236b^^^^236c^^^^2371^^^^2372^^^^2373^^^^2374^^^^2375%
  ^^^^2377^^^^2378^^^^237a^^^^2395^^^^25af^^^^25ca^^^^25cb%
  ^^00}
\lst@RestoreCatcodes
\makeatother

References

  1. Baker, John D. Typesetting UTF8 APL code with the LaTeX lstlisting package. Analyze the Data not the Drivel. August 15, 2011.
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 ()