A T A T EX Session 7: L EX and XƎL P . S. Langeslag 29 November 2018
foo(?=bar) foo(?!bar) (?<=bar)foo (?<!bar)foo PCRE Lookaround Positive lookahead Negative lookahead Positive lookbehind Negative lookbehind
/child\(hood\)\@! \@= \@! \@<= \@<! /\(child\)\@<!hood /child\(hood\)\@= /\(child\)\@<=hood Vim Lookaround Function Syntax Positive lookahead Negative lookahead Positive lookback Negative lookback Syntax Matches “child” where followed by “hood” “child” where not followed by “hood” “hood” where preceded by “child” “hood” where not preceded by “child” ▶ See :help /\@= ff.
:s/child\zehood/mother/ g \ze \zs :s/child\zshood/lessness/ g Zoom Anchors A simpler solution to matching part of a pattern. Syntax Function End the match here Start the match here Syntax Action Replace “child” with “mother” where followed by “hood” Replace “hood” with “lessness” where preceded by “child”
:range g [lobal]/pattern/command : g /friend/s//foe/g # same as ":%s/friend/foe/ g " : g /^$/ d # deletes all empty lines Vim’s global Command The default range is all lines ( % ). Command Options ▶ s[ubstitute] ▶ co[py] ▶ d[elete] ▶ etc. Examples
Word Processing Figure: WordPerfect 5.1 for DOS (public domain)
WYSIWYM: What You See Is What You Mean Display shows text content enriched by structure commands; output not shown. Pros: Separation of content and formatting; explicit formatting control; plaintext may be grep ped Cons: Requires separate viewer for output WYSIWYG and WYSIWYM WYSIWYG: What You See Is What You Get Display emulates print output; explicit formatting is hidden fsom view. ▶ Pros: intuitive, little training required ▶ Cons: users don’t learn to use structural formatting (styles) and wrestle with implicit formatting
WYSIWYG and WYSIWYM WYSIWYG: What You See Is What You Get Display emulates print output; explicit formatting is hidden fsom view. ▶ Pros: intuitive, little training required ▶ Cons: users don’t learn to use structural formatting (styles) and wrestle with implicit formatting WYSIWYM: What You See Is What You Mean Display shows text content enriched by structure commands; output not shown. ▶ Pros: Separation of content and formatting; explicit formatting control; plaintext may be grep ped ▶ Cons: Requires separate viewer for output
Formatting and Content Figure: Views for Content Authoring (CC-BY-SA WMC user)
HTML and CSS Figure: HTML and CSS
T EX A WYSIWYM typesetting engine intended to produce publication-level design and identical output on any system. Released in 1978 by Donald Knuth along with the Computer Modern font family. (Since supplanted by the Latin Modern font family.)
L A T EX T A high-level scripting language for preparing documents using the EX typesetting engine. Ships as a distribution containing T EX , user-contributed packages, and a management system. (We’ll use T EX Live.)
A T EX A T Shortcomings of All L Some elements of L EX (e.g. automated citations) cannot be converted to e.g. docx . This is why we’ll learn to write in Pandoc Markdown later this term.
{ \it M \" o \dh {}ruvallab \' ok \/ } des 14. Jahrhunderts wurde \ss T EX Bei der morphologischen Untersuchung der Sagahandschrift Isl \" andersagas einen doch ziemlich begrenzten Wortschatz \dh hat. Das ermuntert! \" a deutlich, da \ss {} diese Sammlung der Hochbl \" ute der \' a A Shortcomings of Plain L Uses a limited character set, not unicode; diacritics require the use of commands. Command Glyph ä á ß ð (Andrea de Leeuw van Weenen, Grundwortschätz Altisländisch [1999])
XƎL A T EX L A T T T EX scripting using the XƎ EX engine instead of the T EX engine. The XƎ EX engine permits any unicode characters to be directly input, and allows the use of any system font.
L is a piece of cake and a bottle of wine; take them to your grand- gave her hand on it. ‘I will take great care,” said Little Red-Cap to her mother, and don’t peep into every corner before you do it.” you go into her room, don’t forget to say, ‘Good-morning,’ and bottle, and then your grandmother will get nothing; and when etly and do not run ofg the path, or you may fall and break the before it gets hot, and when you are going, walk nicely and qui- mother, she is ill and weak, and they will do her good. Set out One day her mother said to her, ‘Come, Little Red-Cap, here A called ‘Little Red-Cap.’ well that she would never wear anything else; so she was always Once she gave her a little cap of red velvet, which suited her so and there was nothing that she would not have given to the child. every one who looked at her, but most of all by her grandmother, Once upon a time there was a dear little girl who was loved by T (Hunt, trans., Grimm’s Household Tales ) EX Strengths: Kerning and Justification
L A T \autocites [114--125]{hug94the}{cro03med}{kre04med} {lin05sum}{nor06sur}{man08pro}{jor09arc}{knu09pal} {cro10med} EX Strengths: Automated Citations Syntax Output
L A T $y = \frac{x}{\pi}\sqrt{\frac{p}{q + 3}}$ EX Strengths: Formulae Syntax Output √ p y = x q +3 π
L A T \Tree [.NP [.Det a ] [.N \1 [.N house ] [.PP [.P of ] [.NP [.N cards ] ] ] ] ] EX Strengths: Trees and Graphs Syntax Output I NP N ′ Det a N PP house P NP of N cards
L A T EX Strengths: Trees and Graphs Óðinn Sigi Rerir Vǫlsungr Sigmundr Signý 9 more sons Sinfkǫtli Sigurðr son son son child son Áslaug Svanhildr
L A T EX Strengths: Trees and Graphs Pseudo-Ephraem Pseudo-Augustine De virginibus Otfsid Pseudo-Isidore *HomU 55 Pseudo-Bede Muspilli HomU 55 : CCCC 201 *HomU 9 *HomS 4 *HomU 9 : CCCC 41 branch HomU 9 : Vercelli HomS 4 : Bodley 340 HomU 9 : CCCC 41 *HomU 27 [ HomS 4 : Vercelli] HomS 44 WHom 3 Mk 13:12 HomU 27 : Hatton 113 HomS 41 HomS 33 WHom 5 WHom 20 HomM 8 VespHom 2 HomU 25 HomU 49
L child { node[yshift=-2mm] { \emph {HomS 41}} } child { node(HomM8)[xshift=-23mm][yshift=-98mm]{ \emph {HomM 8}} } } } } child { node {[ \emph {HomS 4}: Vercelli]} } child { node { \emph {HomS 4}: Bodley 340} } child { node (HomS4) { \emph {*HomS 4}}[sibling distance=3.5cm] child { node { \emph {HomU 9}: Vercelli} } } } child { node (HomU27) { \emph {*HomU 27}}[sibling distance=31mm] A child { node { \emph {*HomU 9}}[solid][sibling distance=4cm] child { node { \emph {HomU 55}: CCCC 201}[solid] } \begin {tikzpicture} T child { node {Pseudo-Bede} EX Strengths: Trees \node (Eph) {Pseudo-Ephraem}[sibling distance=2cm] child {node {Pseudo-Augustine}[sibling distance=5cm] child {node {Pseudo-Isidore}[sibling distance=2.7cm] child { node (HomU55) { \emph {*HomU 55}} child { node { \emph {*HomU 9}: CCCC 41 branch}[sibling distance=2.5cm] child { node { \emph {HomU 9}: CCCC 41} } child { node { \emph {HomU 27}: Hatton 113 } }
L A T EX Strengths: Enumerated Linguistics Examples (1) Linguists like numbering their example sentences. (2) They set them off like so.
L A T \textara {fuþarkgwhnijpRstbemlŋ} EX Strengths: Runes Syntax Output fuþarkgwhnijpstbeml
A T \documentclass {article} % or "book", "memoir", "beamer" \begin {document} Content goes here. % comments like so Leave a blank line to start a new paragraph. \end {document} Minimal XƎL EX Document Structure
L A T \commandname [option1,option2]{mandatoryargument} \begin {environmentclass}[option1,option2] Content \end {environmentclass} \setlength { \variableName }{newvalue} \addtolength { \variableName }{marginalvalue} \setcounter {variablename}{value} % Typically permitted in body as well as preamble. EX Command Structure Commands Environments Variables
\begin {figure} This text is justified \centering This text is centered \end {figure} \begin {figure} This text is justified \end {figure} Commands Valid for remainder of current scope:
\begin {center} This text is centered \end {center} Environments Allow you to define their scope:
\documentclass [12pt,a4paper,draft,twocolumn,twoside, notitlepage]{book} documentclass Options ▶ Standard classes ▶ KOMA package classes ▶ book ▶ scrbook ▶ article ▶ scrartcl ▶ report ▶ memoir ▶ scrreprt ▶ Paper size options ▶ Regular font size options ▶ a4paper ▶ 10pt ▶ letterpaper ▶ 11pt (default) ▶ etc. ▶ 12pt ▶ twocolumn : use multicol package for more options ▶ twoside : typeset for binding ▶ anypage : allow chapter to start on even page ▶ Each class has its own defaults
Page Layout Figure: A4 Page Dimensions (CC-BY-SA Wikibooks)
A T xelatex --interaction=nonstopmode filename Compiling XƎL EX , 1: On the Command Line ▶ No need to specifz the .tex extension; ▶ You’ll ofuen want to run it a couple times over.
A T Compiling XƎL EX , 2: Using vimtex ▶ \ll starts continuous compilation and opens the PDF; ▶ Any subsequent “save” command ( :w ) recompiles; ▶ Multiple compilation is automated; ▶ \ll (or quitting Vim) ends continuous compilation. ! On ssh , opening the PDF requires X11 forwarding!
A T \documentclass {article} \title {Document Title} \author {Firstname Lastname} \date { \today } \begin {document} \maketitle Content goes here. \end {document} Basic XƎL EX Document Structure With Title Data
Recommend
More recommend