Skip to content

Commit

Permalink
feat: add LaTeX grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Dec 24, 2023
1 parent 4199ad9 commit e462b01
Show file tree
Hide file tree
Showing 7 changed files with 2,488 additions and 2 deletions.
1 change: 1 addition & 0 deletions org.eclipse.tm4e.language_pack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ for the [Eclipse IDE](https://eclipseide.org).
| JSON Lines | file-extensions="jsonl" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/json) [[upstream]](https://github.com/microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70)
| JSON with Comments | file-extensions="babelrc, eslintrc, eslintrc.json, hintrc, jsfmtrc, jshintrc, jsonc, swcrc"<br />file-names=".babelrc.json, .ember-cli, babel.config.json, typedoc.json" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/json) [[upstream]](https://github.com/microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70)
| Julia | file-extensions="jl" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/julia) [[upstream]](https://github.com/JuliaEditorSupport/atom-language-julia/commit/7b7801f41ce4ac1303bd17e057dbe677e24f597f)
| LaTeX | file-extensions="ctx, ltx, tex" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/latex) [[upstream]](https://github.com/jlelong/vscode-latex-basics/commit/580c019674f82ef887a6dcce7bfc75ab0b58486d)
| Less | file-extensions="less" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/less) [[upstream]](https://github.com/atom/language-less/commit/87d4d59e8de6796b506b81a16e1dc1fafc99d30f)
| Lua | file-extensions="lua" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/lua) [[upstream]](https://github.com/sumneko/lua.tmbundle/commit/3a18700941737c3ab66ac5964696f141aee61800)
| Makefile | file-extensions="mak, mk"<br />file-names="GNUmakefile, Makefile, OCamlMakefile, makefile" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/make) [[upstream]](https://github.com/fadeevab/make.tmbundle/commit/1d4c0b541959995db098df751ffc129da39a294b)
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.language_pack/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ <h2>About This Content</h2>
<td>file-extensions="jl"</td>
<td><a href="https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/julia">1.79.0@microsoft/vscode</a> <a href="https://github.com/JuliaEditorSupport/atom-language-julia/commit/7b7801f41ce4ac1303bd17e057dbe677e24f597f">[upstream]</a>
</tr>
<tr>
<td>LaTeX</td>
<td>file-extensions="ctx, ltx, tex"</td>
<td><a href="https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/latex">1.79.0@microsoft/vscode</a> <a href="https://github.com/jlelong/vscode-latex-basics/commit/580c019674f82ef887a6dcce7bfc75ab0b58486d">[upstream]</a>
</tr>
<tr>
<td>Less</td>
<td>file-extensions="less"</td>
Expand Down
20 changes: 20 additions & 0 deletions org.eclipse.tm4e.language_pack/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,26 @@
<languageConfiguration contentTypeId="org.eclipse.tm4e.language_pack.cpp_embedded_latex" path="syntaxes/latex/cpp_embedded_latex.language-configuration.json" />
</extension>

<!-- ======================================== -->
<!-- latex/latex: LaTeX -->
<!-- ======================================== -->
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type id="org.eclipse.tm4e.language_pack.latex" name="LaTeX" base-type="org.eclipse.tm4e.language_pack.basetype" priority="low"
file-extensions="ctx,ltx,tex" />
</extension>
<extension point="org.eclipse.tm4e.registry.grammars">
<grammar scopeName="text.tex.latex" path="syntaxes/latex/latex.tmLanguage.json" />
<scopeNameContentTypeBinding scopeName="text.tex.latex" contentTypeId="org.eclipse.tm4e.language_pack.latex" />
</extension>

<extension point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
<languageConfiguration contentTypeId="org.eclipse.tm4e.language_pack.latex" path="syntaxes/latex/latex.language-configuration.json" />
</extension>

<extension point="org.eclipse.tm4e.ui.snippets">
<snippet name="LaTeX Example" path="syntaxes/latex/latex.example.ltx" scopeName="text.tex.latex" />
</extension>

<!-- ======================================== -->
<!-- latex/markdown_latex_combined: Markdown Latex combined -->
<!-- ======================================== -->
Expand Down
80 changes: 80 additions & 0 deletions org.eclipse.tm4e.language_pack/syntaxes/latex/latex.example.ltx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
\documentclass{article}

% Preamble
\usepackage{amsmath} % for mathematical symbols and environments

\title{Concise LaTeX Example}
\author{Your Name}
\date{\today}

\begin{document}

\maketitle

\section{Introduction}

This is a concise example that demonstrates various LaTeX features.

\section{Formatting Text}

\textbf{Bold text}, \textit{italic text}, \underline{underlined text}.

\subsection{Lists}

\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}

\subsection{Enumerations}

\begin{enumerate}
\item First item
\item Second item
\end{enumerate}

\section{Mathematics}

Inline math: $E=mc^2$.

Display math:
\[
\int_{0}^{1} x^2 \,dx = \frac{1}{3}.
\]

\section{Tables}

\begin{tabular}{|c|c|}
\hline
Header 1 & Header 2 \\
\hline
Cell 1 & Cell 2 \\
\hline
\end{tabular}

\section{Figures}

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{example-image}
\caption{Example Figure}
\label{fig:example}
\end{figure}

\section{Cross-referencing}

See Figure~\ref{fig:example} for an example.

\section{Custom Commands}

\newcommand{\mycommand}{This is a custom command.}

\mycommand

\section{References}

\begin{thebibliography}{9}
\bibitem{example1} Author, A. (Year). Title of the paper. \textit{Journal Name}, \textbf{Volume}(Issue), Page range.
\end{thebibliography}

\end{document}
Loading

0 comments on commit e462b01

Please sign in to comment.