AnnouncementsNew feature: Syntax Highlighting

Rules, announcements and news for this LaTeX Community
Locked
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

New feature: Syntax Highlighting

Post by Stefan Kottwitz »

Hello,

last night I installed syntax highlighting for code in our forum posts. The default language is LaTeX, so all code pieces in our now more than 56.000 posts will show syntax highlighting.

Previously:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\begin{document}
% Eight bullets arranged in a circle, some with letters next to it
\begin{tikzpicture}[every node/.style={node distance=2ex}]
  \foreach \i in {1,...,8}% a for loop
    \node (\i) at (45*\i:1.6) {\textbullet};% nodes with names 1, ..., 8
  \node[right of=1] {L};
  \node[right of=2] {T};
  \node[right of=3] {X};
\end{tikzpicture}
\end{document}
Now:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\begin{document}
% Eight bullets arranged in a circle, some with letters next to it
\begin{tikzpicture}[every node/.style={node distance=2ex}]
  \foreach \i in {1,...,8}% a for loop
    \node (\i) at (45*\i:1.6) {\textbullet};% nodes with names 1, ..., 8
  \node[right of=1] {L};
  \node[right of=2] {T};
  \node[right of=3] {X};
\end{tikzpicture}
\end{document}
This feature shall enhance the readability of code in the forum, especially when it's complex code, and eases discovering syntax errors..

So I even stronger recommend using the Code button for posting code instead of just writing as it was normal text. The result is much nicer.

Stefan
LaTeX.org admin

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Locked