Added module

main
Thomas 2 years ago
parent f374944684
commit 537c26ecd1

@ -1,3 +1,5 @@
# tex
Trainer for entering formulas in TeX syntax
Trainer for entering formulas in TeX syntax
This repository is an optional module for the "lerntools". For installation and configuration, please see the documentation in https://codeberg.org/lerntools/base

@ -0,0 +1,21 @@
import Icon from './img/tex.svg';
export default {
id: "tex",
meta: {
title: {
"de": "TeX-Formel-Trainer",
"en": "TeX formula trainer"
},
text: {
"de": "Trainer zur Eingabe von Formeln im TeX-Syntax",
"en": "Trainer for entering formulas in TeX syntax"
},
to: "tex-trainer",
icon: Icon,
},
routes: [
{ path: '/tex-trainer', name:'tex-trainer', component: () => import('./views/TexTrainer.vue') },
]
}

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18.881"
height="18.881"
viewBox="0 0 4.996 4.996"
version="1.1"
id="svg4"
sodipodi:docname="tex.svg"
inkscape:version="0.92.2 2405546, 2018-03-11">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1005"
id="namedview6"
showgrid="false"
inkscape:zoom="24.998675"
inkscape:cx="9.4405003"
inkscape:cy="9.4405003"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<g
aria-label="T"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23367405px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26460463"
id="text14">
<path
d="M 2.0237263,1.2650747 V 1.7076328 H 1.9803146 Q 1.9417264,1.554486 1.8946971,1.4881625 1.8476677,1.4206332 1.7656679,1.3808392 1.7198444,1.3591333 1.6052858,1.3591333 h -0.121794 v 1.261351 q 0,0.1254115 0.013265,0.1567644 0.014471,0.031353 0.054265,0.055471 0.041,0.022912 0.110941,0.022912 h 0.054265 v 0.044618 H 0.86005166 V 2.855631 h 0.0542646 q 0.0711469,0 0.11455862,-0.025323 0.031353,-0.016882 0.049441,-0.057882 0.013265,-0.028941 0.013265,-0.1519409 V 1.3591333 H 0.97340442 q -0.16520562,0 -0.23997021,0.069941 -0.10491159,0.097676 -0.13264684,0.2785584 H 0.55496391 V 1.2650747 Z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46964312px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Bold';stroke-width:0.26460463"
id="path48" />
</g>
<g
aria-label="E"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23367405px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26460463"
id="text14-2">
<path
d="m 2.3753624,2.2194253 v 0.665646 h 0.032559 q 0.1555586,0 0.2254996,-0.097676 0.069941,-0.097676 0.089235,-0.2882054 h 0.045823 V 3.3553647 H 2.722656 Q 2.7081854,3.2154825 2.6611561,3.1262474 2.6153326,3.0370122 2.5538327,3.0068652 2.4923328,2.9755123 2.3753624,2.9755123 v 0.4606464 q 0,0.1350586 0.010853,0.1652056 0.012059,0.030147 0.043412,0.049441 0.031353,0.019294 0.101294,0.019294 h 0.097676 q 0.2291173,0 0.3665877,-0.1061175 0.1386762,-0.1061175 0.1989702,-0.323176 h 0.044618 L 3.1652141,3.7605405 H 1.7519222 v -0.044618 h 0.054265 q 0.071147,0 0.1145586,-0.025323 0.031353,-0.016882 0.048235,-0.057882 0.013265,-0.028941 0.013265,-0.151941 V 2.4051309 q 0,-0.110941 -0.00603,-0.1362645 Q 1.9641572,2.2266606 1.9315984,2.2037489 1.885775,2.1699842 1.8061869,2.1699842 H 1.7519222 V 2.1253666 H 3.1205965 V 2.6089247 H 3.0747731 Q 3.0398025,2.4316603 2.9758909,2.3544839 2.9131851,2.2773076 2.7974206,2.2411311 2.7298913,2.2194253 2.5441857,2.2194253 Z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46964312px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Bold';stroke-width:0.26460463"
id="path45" />
</g>
<g
aria-label="X"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23367405px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26460463"
id="text14-4">
<path
d="M 3.9416438,2.0080096 4.392643,2.6772733 q 0.1121469,0.1664115 0.1591763,0.2025879 0.048235,0.034971 0.1133527,0.042206 v 0.044618 H 3.8680851 V 2.922067 q 0.095264,-0.00724 0.1229998,-0.028941 0.027735,-0.021706 0.027735,-0.053059 0,-0.021706 -0.00844,-0.038588 -0.016882,-0.036176 -0.084412,-0.1350586 L 3.687203,2.3130974 3.4375857,2.6181851 q -0.1121468,0.1386763 -0.1121468,0.1881174 0,0.034971 0.028941,0.065117 0.028941,0.030147 0.085618,0.043412 0.025323,0.00724 0.1037057,0.00724 v 0.044618 H 2.9154395 V 2.922067 q 0.1073234,-0.015676 0.1688233,-0.057882 0.080794,-0.055471 0.2254996,-0.231529 L 3.6341442,2.2371269 3.2181155,1.6257455 Q 3.1156157,1.4750105 3.1011451,1.4581282 3.0685863,1.4183341 3.0372334,1.4014518 3.0058805,1.3845695 2.95041,1.3761283 v -0.044618 h 0.8115576 v 0.044618 h -0.041 q -0.069941,0 -0.097676,0.022912 -0.027735,0.021706 -0.027735,0.05547 0,0.026529 0.00844,0.045824 L 3.687203,1.6257455 3.8897909,1.9344509 4.0622318,1.7234219 Q 4.1948786,1.560628 4.1948786,1.4955105 q 0,-0.032559 -0.019294,-0.060294 -0.018088,-0.027735 -0.053059,-0.043412 -0.034971,-0.015676 -0.1085292,-0.015676 v -0.044618 h 0.6017343 v 0.044618 q -0.071147,0.00121 -0.1145586,0.018088 -0.043412,0.015676 -0.092853,0.060294 -0.031353,0.028941 -0.1567645,0.1796762 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46964312px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Bold';stroke-width:0.26460463"
id="path42" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.0 KiB

@ -0,0 +1,122 @@
<template>
<div>
<page-title :title="$t('tex-trainer-title')" :subtitle="$t('tex-trainer-info')" :button="$t('learn-more')" buttonhref="https://www.wikipedia.org/wiki/TeX"/>
<div class="container mt-3">
<div class="row">
<div class="col-md-6 mb-4">
<div class="card shadow">
<div class="card-header bg-var text-white">{{$t('tex-trainer-input')}}</div>
<div class="card-body" style="min-height:8em">
<div class="form-group">
<textarea class="form-control" v-model="text" :placeholder="$t('tex-trainer-input-info')"/>
</div>
</div>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="card shadow">
<div class="card-header bg-var text-white">{{$t('tex-trainer-output')}}</div>
<div class="card-body" style="min-height:8em">
<div v-html="texHtml"/>
</div>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="card shadow">
<div class="card-header bg-var text-white">{{$t('examples')}}</div>
<div class="card-body" style="min-height:8em">
<p>{{$t('select-example')}}</p>
<select class="form-control" v-model="example">
<option value='f(x)=mx+t'>{{$t('equation-linear')}}</option>
<option value='f(x)=ax^2+bx+c'>{{$t('equation-quadratic')}}</option>
<option value='x_{1,2}=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'>{{$t('equation-quadratic-solution')}}</option>
<option value='f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)'>{{$t('equation-gauss')}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="card shadow">
<div class="card-header bg-var text-white">{{$t('hints')}}</div>
<div class="card-body">
<p>{{$t('tex-trainer-help')}}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import PageTitle from 'Main/components/PageTitle.vue';
import color from 'Main/js/color.js';
import texit from 'Main/js/texit.js';
export default {
components: { PageTitle },
data: function() {
return {
text:'',
example:'',
texHtml:''
}
},
mounted: function() {
color.setBgVar();
},
watch: {
text: function() {
this.texHtml=texit.texToHtml(this.text,true);
},
example: function() {
this.text=this.example;
}
}
}
</script>
<style src='../../../node_modules/katex/dist/katex.min.css'/>
<i18n>
{
"de": {
"tex-trainer-title": "TeX-Formel-Trainer",
"tex-trainer-info": "Bereits 1977 began Donald E. Knuth mit der Entwicklung von TeX, das den professionellen Schritftsatz mathematischer Formeln ermöglicht. Noch heute wird TeX aktiv entwickelt und auch auf Webseiten für den Satz von Formeln verwendet. Bekannte Beispiele sind z.B. Moodle oder Wikipedia, die ebenfalls den TeX-Syntax unterstützen.",
"learn-more": "Wikipedia Artikel",
"tex-trainer-input": "Eingabe TeX",
"tex-trainer-input-info": "Bitte geben Sie hier die Formel im TEX-Syntax ein!",
"tex-trainer-output": "Ausgabe Formel",
"examples": "Beispiele",
"select-example": "Wählen Sie ein Beispiel",
"equation-linear": "Lineare Gleichung",
"equation-quadratic": "Quadratische Gleichung",
"equation-quadratic-solution": "Lösungsformel quadratische Gleichung",
"equation-gauss": "Gaussche Normalverteilung",
"hints": "Hiweise",
"tex-trainer-help": "Die $-Zeichen zu Beginn und Ende einer Formel sind hier nicht notwendig, Fehler werden in roter Farbe angezeigt."
},
"en": {
"tex-trainer-title": "TeX formula trainer",
"tex-trainer-info": "Already in 1977, Donald E. Knuth began developing TeX, which enables professional typesetting of mathematical formulas. Even today, TeX is actively being developed and used on web pages for rendering formulas. Known examples are e.g. Moodle or Wikipedia, which also support the TeX syntax.",
"learn-more": "Wikipedia article (German)",
"tex-trainer-input": "Input TeX",
"tex-trainer-input-info": "Please enter the formula in TEX syntax here!",
"tex-trainer-output": "Output formula",
"examples": "Examples",
"select-example": "Select an example",
"equation-linear": "Linear equation",
"equation-quadratic": "Quadratic equation",
"equation-quadratic-solution": "Solution formula quadratic equation",
"equation-gauss": "Gaussian normal distribution",
"hints": "Hints",
"tex-trainer-help": "The $ -signs at the beginning and end of a formula are not necessary here, errors are displayed in red."
}
}
</i18n>
Loading…
Cancel
Save