From eeb80384fdd553c019b96c55f946e2f5e2164911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Hutter?= Date: Tue, 15 Mar 2022 17:08:43 +0100 Subject: [PATCH 1/4] Added style definition for kotlin --- style/langdef-kotlin.tex | 18 ++++++++++++++++++ style/template.tex | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 style/langdef-kotlin.tex diff --git a/style/langdef-kotlin.tex b/style/langdef-kotlin.tex new file mode 100644 index 0000000..60f0c57 --- /dev/null +++ b/style/langdef-kotlin.tex @@ -0,0 +1,18 @@ + +% Kotlin +\lstdefinelanguage{Kotlin}{ + comment=[l]{//}, + commentstyle={\color{gray}\ttfamily}, + emph={filter, first, firstOrNull, forEach, lazy, map, mapNotNull, println}, + emphstyle={\color{OrangeRed}}, + identifierstyle=\color{black}, + keywords={!in, !is, abstract, actual, annotation, as, as?, break, by, catch, class, companion, const, constructor, continue, crossinline, data, delegate, do, dynamic, else, enum, expect, external, false, field, file, final, finally, for, fun, get, if, import, in, infix, init, inline, inner, interface, internal, is, lateinit, noinline, null, object, open, operator, out, override, package, param, private, property, protected, public, receiveris, reified, return, return@, sealed, set, setparam, super, suspend, tailrec, this, throw, true, try, typealias, typeof, val, var, vararg, when, where, while}, + keywordstyle={\color{NavyBlue}\bfseries}, + morecomment=[s]{/*}{*/}, + morestring=[b]", + morestring=[s]{"""*}{*"""}, + ndkeywords={@Deprecated, @JvmField, @JvmName, @JvmOverloads, @JvmStatic, @JvmSynthetic, Array, Byte, Double, Float, Int, Integer, Iterable, Long, Runnable, Short, String, Any, Unit, Nothing}, + ndkeywordstyle={\color{BurntOrange}\bfseries}, + sensitive=true, + stringstyle={\color{ForestGreen}\ttfamily}, +} \ No newline at end of file diff --git a/style/template.tex b/style/template.tex index e63b4fe..4a839b4 100644 --- a/style/template.tex +++ b/style/template.tex @@ -287,7 +287,7 @@ $endif$ \input{style/langdef-css.tex} \input{style/langdef-html.tex} \input{style/langdef-xml.tex} - +\input{style/langdef-kotlin.tex} $endif$ % From 354eb3e106bec035d471542682bee59287b7cb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Hutter?= Date: Tue, 15 Mar 2022 17:19:30 +0100 Subject: [PATCH 2/4] Better readability --- style/langdef-kotlin.tex | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/style/langdef-kotlin.tex b/style/langdef-kotlin.tex index 60f0c57..b6be0eb 100644 --- a/style/langdef-kotlin.tex +++ b/style/langdef-kotlin.tex @@ -6,12 +6,22 @@ emph={filter, first, firstOrNull, forEach, lazy, map, mapNotNull, println}, emphstyle={\color{OrangeRed}}, identifierstyle=\color{black}, - keywords={!in, !is, abstract, actual, annotation, as, as?, break, by, catch, class, companion, const, constructor, continue, crossinline, data, delegate, do, dynamic, else, enum, expect, external, false, field, file, final, finally, for, fun, get, if, import, in, infix, init, inline, inner, interface, internal, is, lateinit, noinline, null, object, open, operator, out, override, package, param, private, property, protected, public, receiveris, reified, return, return@, sealed, set, setparam, super, suspend, tailrec, this, throw, true, try, typealias, typeof, val, var, vararg, when, where, while}, + keywords={!in, !is, abstract, actual, annotation, as, as?, break, by, + catch, class, companion, const, constructor, continue, crossinline, + data, delegate, do, dynamic, else, enum, expect, external, false, + field, file, final, finally, for, fun, get, if, import, in, infix, + init, inline, inner, interface, internal, is, lateinit, noinline, + null, object, open, operator, out, override, package, param, private, + property, protected, public, receiveris, reified, return, return@, + sealed, set, setparam, super, suspend, tailrec, this, throw, true, + try, typealias, typeof, val, var, vararg, when, where, while}, keywordstyle={\color{NavyBlue}\bfseries}, morecomment=[s]{/*}{*/}, morestring=[b]", morestring=[s]{"""*}{*"""}, - ndkeywords={@Deprecated, @JvmField, @JvmName, @JvmOverloads, @JvmStatic, @JvmSynthetic, Array, Byte, Double, Float, Int, Integer, Iterable, Long, Runnable, Short, String, Any, Unit, Nothing}, + ndkeywords={@Deprecated, @JvmField, @JvmName, @JvmOverloads, @JvmStatic, + @JvmSynthetic, Array, Byte, Double, Float, Int, Integer, Iterable, + Long, Runnable, Short, String, Any, Unit, Nothing}, ndkeywordstyle={\color{BurntOrange}\bfseries}, sensitive=true, stringstyle={\color{ForestGreen}\ttfamily}, From 717f4b43e9869bd8f7f706914812950354dae4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Hutter?= Date: Tue, 15 Mar 2022 17:19:57 +0100 Subject: [PATCH 3/4] Added vba as code style --- style/langdef-vba.tex | 20 ++++++++++++++++++++ style/template.tex | 1 + 2 files changed, 21 insertions(+) create mode 100644 style/langdef-vba.tex diff --git a/style/langdef-vba.tex b/style/langdef-vba.tex new file mode 100644 index 0000000..f9c1d33 --- /dev/null +++ b/style/langdef-vba.tex @@ -0,0 +1,20 @@ +%VBA +\lstdefinelanguage{VBA}{ + morekeywords={And, As, Byte, Call, Case, Compare, CDbl, Datebase, Date, + Dim, Else, ElseIf, End, Error, Exit, Explicit, False, Function, + GoTo, If, IIF, Integer, Not, Nothing, Null, Object, On, Option, Or, + Private, Resume, String, Single, Select, Set, Static, Sub, Then, True, To,}, + sensitive=false, + morecomment=[l]Rem, + morecomment=[l]', + morestring=[b]", + emph={acFormBar, acEditMenu, acCurrent, acEntire, acMenuVer70, acSaveYes, + acViewNormal, acForm, acDataErrAdded, acNewRec, acDataErrContinue, Cancel, + CancelEvent, Close, CurrentDb, DefaultValue, DateValue, DAO, Description, + DoCmd, DoMenuItem, Err, Error, Error$, $, Execute, FindRecord, Forms, + FindFirst, IsNull, Me, MsgBox, GoToControl, GoToRecord, NewData, Nz, + Maximize, Number, OpenForm, Parent, Recordset, Requery, Response, SetFocus, + stDocName, stLinkCriteria, Value, vbExclamation, vbOK, vbOKCancel, + vbInformation, vbYes, vbNo, vbYesNo, vbCancel, vbQuestion, vbYesNoCancel, + Visible,}, + emphstyle=\itshape} \ No newline at end of file diff --git a/style/template.tex b/style/template.tex index 4a839b4..f1bc031 100644 --- a/style/template.tex +++ b/style/template.tex @@ -288,6 +288,7 @@ $endif$ \input{style/langdef-html.tex} \input{style/langdef-xml.tex} \input{style/langdef-kotlin.tex} +\input{style/langdef-vba.tex} $endif$ % From 7a4b5ebe74a06493a1ce9534cd84ec0862cc8d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Hutter?= Date: Tue, 15 Mar 2022 17:25:21 +0100 Subject: [PATCH 4/4] Example for new Languages --- example/32-ausarbeitung_schueler2.md | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/example/32-ausarbeitung_schueler2.md b/example/32-ausarbeitung_schueler2.md index dc3da52..b55e492 100644 --- a/example/32-ausarbeitung_schueler2.md +++ b/example/32-ausarbeitung_schueler2.md @@ -124,6 +124,38 @@ Obwohl hier nur java gezeigt ist, unterstützt das Template auch scala, java, ja ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Hier etwas in kotlin + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{caption="Ein einfaches Kotlin Beispiel" .kotlin} +// this is a simple code listing: +println("hello kotlin from latex") +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +Und noch ein Beispiel in vba + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{caption="Ein einfaches Visual Basic for Applications Beispiel" .vba} +Private Sub ExitSub() + + Dim i As Integer + + For i = 1 To 10 + If i = 5 Then + Exit Sub + MsgBox "The value of i is" & i + End If + Next i + +End Sub + + +Private Sub CallExitSub() + Call ExitSub + MsgBox "Exit Sub" +End Sub +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ### Auswertung der Ergebnisse Anhand von XY kann man folgende Tabelle ableiten: