27

As per the SO question here (if you want to know how they did something there, take a look at the source, as per the hack documented here), I suggest that this (CW) question be used for testing purposes. Feel free to edit this question, add answers, experiment with deletion or markdown or what-have you.

Use this Markdown Editing Help reference as a guide, or this tome if you want to know every detail.

I'll take this question down if the community thinks that it is inappropriate, but if it is appropriate, we could have something like it pointed to in the FAQ and in the markdown manual.

7
  • Not a duplicate of this LaTeX sandbox proposal Jul 30, 2010 at 19:53
  • See this page for information on comment markup. Jul 30, 2010 at 19:59
  • Has nothing to do with LaTeX sandbox porposal...but if this is confusing I'll edit to make it clear. Jul 31, 2010 at 1:17
  • Testing backslashes in comments: \ ~ <bt><bt>\<bt><bt>; \\ ~ <bt>bt>\\<bt><bt>; \ ~ <bt><bt>\ <bt><bt>. Here <bt>=`.
    – Werner Mod
    Jan 3, 2013 at 0:31
  • @Werner -- i think one of those bracketed bts has a left angle missing. (thanks for the pointer.) Mar 26, 2013 at 19:31
  • Single quote comment (with leading spaces): ` code`
    – Werner Mod
    Apr 11, 2022 at 18:49
  • Double quote comment (with leading spaces): `` code``
    – Werner Mod
    Apr 11, 2022 at 18:49

9 Answers 9

7

Typesetting backslashes, backticks and spaces:

  1.  
  2. \
  3. \
  4. \\
  5. `
  6. ``
  7. `
  8. ``` ``
  9. ``
  10. ``` `
  11. \`
  12. \`
  13.  

Use HTML formatting mixed with markdown for spaces.

1. &nbsp;
2. \\
3. `\`
4. `\\`
5. <code>\&nbsp;</code>
6. `
7. ``
8. <code>`</code>
9. ``` ``
10. <code>``</code>
11. ``` `
12. <code>\\`</code>
13. ``\` ``
14. <code>&nbsp;</code>

Link testing:


Taken from In comments - how do I highlight with back-ticks when the last character is a backslash:

Here are the rules for inline code in posts and comments.

POSTS: If you want backticks inside an inline code snippet, surround them with any amount of backticks not used in the code. Examples:

  • ``this is a `backtick` thing`` renders as this is a `backtick` thing
  • ````here are one ` two `` three ``` backticks```` renders as here are one ` two `` three ``` backticks
  • Use spaces if backticks are at beginning or end - `` $` `` renders as $`
  • `testing testing\`123`testing` renders as testing testing\123testing

COMMENTS: Simply use \ to escape backticks. Limitation: you can't escape backslashes, so you can't have a backslash at the end of an inline code snippet. Also, `test`123`test` doesn't work.

  • `this is a \`backtick\` thing` renders as this is a `backtick` thing
  • etc.
  • `testing testing\ `123 `testing` renders as testing testing\ 123 testing
3
6

Here's an answer which can be used as sandbox answer. Feel free to edit if you wish to try markdown. Below the line would be good. So, the question doesn't remain unanswered.


Here's a funny formatting trap: code after a list item doesn't format: Why do code snippets not work after lists? The solution is to insert an HTML comment between the list item and the code:

  • A list item

    \begin{document}

  • Another list item with <!> after it and some following code: (needs to be separated by blank lines):

\begin{document}

Perl?

sub run_command (@) {
    my $origcmdline = join(" ", grep {defined} @_);
    return if $origcmdline eq "";

    my $cmdline = $origcmdline;

description lists

\predisplaypenalty
penalty for page break just before a display

doesn't look very promising in preview…

TEX

Hm, would've been nice

  • A list
  •   Some code
      

(See LaTeX Editors/IDEs.)

Bla bla bla*.*
Bla bla bla_._
Bla bla bla.

The text is from http://el.wikipedia.org/wiki/Αθήνα foo

5
  • @morbusg: Interesting, description lists should work according to meta.stackexchange.com/questions/1777/….
    – doncherry
    Apr 9, 2012 at 12:50
  • 2
    @doncherry They do, at least the HTML tags show up in the source code. However, as there is no CSS to format them, the result is not very pretty. See also the feature request Better style for HTML 'definition list' <dl> elements on meta.SO.
    – diabonas
    Apr 9, 2012 at 13:34
  • <code>\\</code>
    – Canageek
    Jul 31, 2012 at 22:58
  • 1
    \, \\... Aug 1, 2012 at 7:30
  • With this setup, does the font for regular text come from the charter package or mathdesign? Switching the order of \usepackage{charter} and \usepackage[charter]{mathdesign} produces different outputs. Also, the latter setup complains about Font shape T1/bch/m/fsc undefined(Font) .. (small caps?)
    – DCh
    Apr 10, 2014 at 17:15
5

Just testing some entities:

&#211hello; in the preview produces Óhello; What happens in the main?

&#211hello;

Strike out works.

2
  • does this work \\ more text? Nov 19, 2021 at 22:05
  • this should work \\​ ... Nov 19, 2021 at 22:11
4

Shrt nswrs r k.​​​

1
  • cmmnt.
    – yo'
    Jan 13, 2013 at 21:07
3

Trying to see if I can put in < and >:

$1 > 2$ while $2 < 3$.  \\
Seems to be OK with new stuff.

Code inside list is indented by more space (twice more than the usual):

Code:

This is code because four spaces go before me.
  • This is a bullet!

    I am not code even though there are four spaces before me. But, if eight spaces precede me, I'll be one.

    Like this.
    
2
  1. a list
    1. with stuff
  2. in it
1

Testing link prettification for https URLs: Formatting Sand-Box

Testing link prettification for http URLs: Formatting Sand-Box

Testing link prettification for protocol-less URLs: //meta.tex.stackexchange.com/q/208/21344

0

Made this JSFiddle script for basic markup + latex editing / printing.

Allows to:

  • Copy-paste src (original, markup with rendered math, html with rendered math) to a math question.
  • Print rendered HTML.

** EDIT: Just found out about https://hackmd.io/ which does a very good job for latex sandbox and more.

1
0

Just a sandbox post, please ignore.





























































The code iterates through different combinations of jot, baselineskip, lineskip, and create a normal gather environment and a array environment. Then for each item use zref-savepos to measure the vertical distance between the 2 lines, then report the result.

Replace \pretty with \tl_show if you want. (will print the log on the terminal)

rendered document

The log: (there are 2 wrong entries unfortunately...)

result log


%! TEX program = lualatex
\documentclass{article}
\usepackage{amsmath}
\usepackage{prettytok}
\usepackage{zref-savepos}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\errorcontextlines=100
\begin{document}

\ExplSyntaxOn


\def \__index {0}
\clist_map_variable:nNn {
 0sp/0sp/0sp,
 0sp/0sp/5sp,
 0sp/5sp/0sp,
 0sp/5sp/5sp,
 5sp/0sp/0sp,
 5sp/0sp/5sp,
 5sp/5sp/0sp,
 5sp/5sp/5sp,
 0sp/0sp/1cm,
 0sp/1.1cm/0sp,
 0sp/1.1cm/1cm,
 1.2cm/0sp/0sp,
 1.2cm/0sp/1cm,
 1.2cm/1.1cm/0sp,
 1.2cm/1.1cm/1cm
 } \__a {
 

 \edef\__index{\int_eval:n {\__index+1}}

 \def \__match #1/#2/#3/ {
  \def\jot{#1}
  \baselineskip=#2\relax
  \lineskip=#3\relax
 }
 \expandafter \__match \__a/



 
\begingroup

%\savebox\strutbox {}

\begin{gather*}
 a=b \zsavepos{a\__index} \\
 \dfrac22 \zsavepos{b\__index}
\end{gather*}

\endgroup

\dim_compare:nNnTF {\baselineskip} = {0sp} {
 \edef\customskip{\dim_to_decimal_in_sp:n{\dimexpr\lineskip+\jot\relax} sp}
} {
\let\customskip\jot
}
\[
 \renewcommand\arraystretch{0}
 %\baselineskip=\baselineskipx\relax
 \edef\oldbaselineskip{\the\baselineskip}
 \edef\oldlineskip{\the\lineskip}
 \begin{array}{c}
  %\baselineskip=\normalbaselineskip
  a=b      \zsavepos{c\__index} \copy\strutbox \rule[\dimexpr-0.3\dimexpr\oldbaselineskip\relax\relax]{0pt}{\dimexpr\oldbaselineskip\relax} \\[0pt] \\[\customskip] \\[0pt]
  \dfrac22 \zsavepos{d\__index} \copy\strutbox \rule[\dimexpr-0.3\dimexpr\oldbaselineskip\relax\relax]{0pt}{\dimexpr\oldbaselineskip\relax}
 \end{array}
\]



\pretty:x{
 case~\__index.~
 \int_eval:n{\zposy{a\__index} - \zposy{b\__index}}sp
 =
 \int_eval:n{\zposy{c\__index} - \zposy{d\__index}}sp
}


\int_compare:nNnTF 
 {\zposy{a\__index} - \zposy{b\__index}}
 =
 {\zposy{c\__index} - \zposy{d\__index}}
 {
 }
 {
  \pretty:n{ERROR!}
 }

}

\ExplSyntaxOff







\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .