29
votes
How to make a single word look as some code?
I can't believe nobody mentioned the listings package. It provides a command called \lstinline{your_code} which can even highlight keywords for you.
See also this question: Should I use \lstinline ...
28
votes
Accepted
How to Draw Gabriel's Horn
Almost same image but from a different point of view and with the sun in a different position.
Using only tikz with the library math and layers. It may take some time to execute; the time can be ...
27
votes
Accepted
What characters are allowed to use as delimiters for BibTeX keys?
First of all, spaces are not allowed in key names, so we can concentrate on other special characters.
BibTeX
I have prepared the following test file:
@article{a{}b$,
author={A. Uthor},
title={With ...
26
votes
How can I type the symbol for usual topology $R_{(-)}$ in LaTex?
Sigur's answer might be appealing, but it has a big defect: with \usepackage{MnSymbol} you change every math symbol in your document to shapes that are thought to accompany Minion.
Besides, I find ...
18
votes
How to transcript codes from HP 50G in LaTeX
This answer tries to reproduce the screenshot. It uses the lcd package, which defines an extended alphanumeric character set, with each character constructed using dots set in a 5 x 7 matrix. Thus, ...
18
votes
Replicating a chronodex in TikZ
I recreated everything from scratch and made it a \pic that is highly customizable and allows for 24-hours or am/pm format. It uses the calendar library which should make it easy to create a full ...
16
votes
How to format an inline source code
You can create your \inlinecode command which adapts to various languages.
Here is some piece of code I've been using and which was very helpful to me:
\usepackage{listings}
\usepackage{color}
\...
15
votes
How to present a Python code snippet efficiently in LaTeX?
Here is the way I like to do. Of course you can change colors, font sizes, borders and so on.
You need Pygments to use minted.
MWE
\documentclass[11pt,a4paper]{report}
\usepackage{tcolorbox}
\...
15
votes
Accepted
Single-key teletype?
\documentclass{article}
\usepackage{shortvrb}
\MakeShortVerb|
\begin{document}
this |and| that or |the other|
\end{document}
shortvrb is in the core base latex distribution.
15
votes
How can I type the symbol for usual topology $R_{(-)}$ in LaTex?
Another possibility, cutting out the parenthesis from a \bigcirc to get more round symbols. To get a more similar symbols with square brackets, I cut them out of amssymb's \square.
\documentclass{...
14
votes
Accepted
Is it possible to use tikzmark inside minted?
Yes, it appears to work, you just need to specify an escape character (? here) to minted so you can insert the \tikzmark.
\documentclass{article}
\usepackage{minted}
\usepackage{tikz}
\usetikzlibrary{...
14
votes
Accepted
Display bash code in LaTeX
In LaTeX, in order to display bash code and any other code, you can use the listings package.
The \lstset command is used to control the basic appearance, including the language of code. Please see ...
14
votes
How to Draw Gabriel's Horn
I don't know if this helps, but I was able to do it with pgfplots as follows;
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=...
13
votes
Triangle Notation in Spain
You can import the symbol from yhmath:
\documentclass{article}
\usepackage{amsmath}
\DeclareSymbolFont{yhlargesymbols}{OMX}{yhex}{m}{n}
\DeclareMathAccent{\widetriangle}{\mathord}{yhlargesymbols}{"...
13
votes
How to illustrate the Mean Value theorem?
Some PSTricks solutions only for fun purposes!
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-plot,pst-eucl}
\def\f{(x-1)^2/5+1}
\def\L#1#2#3{\psCoordinates[linestyle=dashed](#...
12
votes
Accepted
How to transcript codes from HP 50G in LaTeX
Does this look better?
\documentclass[a4paper]{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily, columns=fullflexible, keepspaces=true}
\begin{document}
\begin{lstlisting}
<< SWAP ...
12
votes
How can I type the symbol for usual topology $R_{(-)}$ in LaTex?
Just because a tikz answer is always required ... Here is one using the Arc Barb arrowhead style of the arrows.meta library.
EDIT Added a line cap=round option to show that you can pretty much ...
11
votes
Aligning table within latex editor
In TexStudio you select the data in your table and go to (top of the screen)
LaTeX > Manipulate Tables > Align Columns
This will neatly align your table at the &'s.
11
votes
Single-key teletype?
Use fancyvrb and \DefineShortVerb (although you might not want to use `)
\documentclass{article}
\usepackage{fancyvrb}
\DefineShortVerb\`
\begin{document}
I'm writing a document with a ton of ...
11
votes
Accepted
what package should I use for $\mathscr{C}$?
A font that gives nice (in my extremely humble opinion, the nicest) \mathscr{} is given by the mathrsfs package. There are many others...
11
votes
Accepted
How can I type the symbol for usual topology $R_{(-)}$ in LaTex?
What about \leftfree \mkern -12mu \rightfree from MnSymbol package?
\documentclass{report}
\usepackage{amssymb}
\usepackage{MnSymbol}
\begin{document}
\[ \mathbb{R}_{\leftfree\mkern -12mu\rightfree} \...
11
votes
Accepted
Replicating a chronodex in TikZ
Nice work so far. Please find below my refactored code, which replaces many draw statements by a handful of loops.
Refactoring is a nice thing to do. Whenever you finished some part, like a set of ...
10
votes
How can I auto-indent in TeXstudio?
There is also Indent and unindent automatically under Options -> Editor -> Indentation Mode.
I understand the author is happy with previous suggestions, but I hope it may help others since this ...
10
votes
Accepted
How to call out sections of source code?
Based on cmhughes comment sugessting the use of tikzmark, and the multiline bracket solution found here, I was able to come up with the following:
\documentclass{article}
\usepackage{enumitem}
\...
10
votes
Triangle Notation in Spain
\documentclass{article}
\usepackage{stackengine,scalerel,graphicx}
\stackMath
\newcommand\that[1]{%
\setbox0=\hbox{$#1$}%
\ensurestackMath{%
\stackon[2pt]{\copy0}{\,\rotatebox{90}{\stretchto{\...
10
votes
what package should I use for $\mathscr{C}$?
To use \mathscr, you can use the mathrsfs package as already mentioned. I think it is also worth mentioning the mathalpha package, which allows to use several different math script fonts.
Here's a ...
10
votes
How can I type the symbol for usual topology $R_{(-)}$ in LaTex?
Here are two possibilities.
\documentclass{article}
\usepackage{amssymb} % for \mathbb macro
\begin{document}
$\mathbb{R}_{( \mkern-6mu -\mkern-6mu )}$ or
$\mathbb{R}_{\scriptscriptstyle( \mkern-6mu ...
10
votes
How to mimic StackExchange-style inline code in LaTeX
A solution which requires the use of LuaLaTeX.
\documentclass{article}
\usepackage{xcolor}
\usepackage{luacolor}
\usepackage{lua-ul}
\NewDocumentCommand{\Code}{v}{\highLight[gray!20]{\texttt{#1}}}
\...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
code × 772listings × 240
minted × 80
formatting × 50
verbatim × 48
color × 42
tables × 33
highlighting × 30
python × 26
sourcecode × 26
fonts × 24
macros × 21
tikz-pgf × 19
beamer × 18
pdftex × 17
packages × 17
line-breaking × 16
tcolorbox × 16
environments × 15
matlab × 15
lyx × 14
overleaf × 14
math-mode × 12
spacing × 12
graphics × 12