This site is supported by donations to The OEIS Foundation.

Template:LaTeX/Example/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:LaTeX/Example. [<Edit> Template:LaTeX/Example]

[⧼Purge⧽ Template:LaTeX/Example/doc]

This template is meant to render examples of LaTeX usage in a consistent manner. It produces a table with LaTeX code on the left and the rendering (or a provided image) on the right.

Usage

{{LaTeX/Example|code = LaTeX code}}

or

{{LaTeX/Example|code = LaTeX code|render = alternate LaTeX code}}

or

{{LaTeX/Example|code = LaTeX code|image = rendering}}

The required code parameter is passed to the {{#tag:source}} construct (preferably, if it was supported by OEIS Wiki, since with the SyntaxHighlight GeSHi MediaWiki extension we may have syntax highlighting of source code) or to the {{#tag:pre}} construct. An alternate code (render parameter) may be provided if code can't be rendered, or an image (image parameter). Pipe characters | have to be escaped using the {{!}} template. Don't try using the {{#!:}} construct as it will be passed along (don't know why though).

Examples

The code

: {{LaTeX/Example
| code =

 \left. x^2 + y^2 = z^2 \right{{!}}_{x=<0,1>}

}}

yields

 \left. x^2 + y^2 = z^2 \right|_{x=<0,1>} 

: {{LaTeX/Example
| code =

 \sum_{\substack{
   0<i<m \\
   0<j<n
  }<!-- -->} 
 P(i,j)

| render = {\color{red} Unsupported: \backslash substack}
}}

yields

 \sum_{\substack{
   0<i<m \\
   0<j<n
  }} 
 P(i,j) 

Code

<noinclude>{{Documentation}}</noinclude><includeonly>:{| style="margin-top: 1.5em; margin-bottom: 1.5em;"
|-
| style="border-right: 2px black solid; padding-right: 3em;" |
{{#if: {{{1|{{{code|}}}}}} 
| {{#tag:pre| {{{1|{{{code}}}}}} | lang = latex | enclose = none | style = "overflow: auto;" }}<!-- 
{{#tag:source| {{{1|{{{code}}}}}} | lang = latex | enclose = none | style = "overflow: auto;" }} -->
| {{Error| LaTeX/Example error: Code argument is required! }} 
}}
| style="padding-left: 3em;" |
{{#if: {{{render|}}} 
| {{#tag:math| {{{render}}} }}  
| {{#if: {{{image|}}} 
  | {{{image}}}
  | {{#tag:math| {{{1|{{{code|}}}}}} }}   
  }} 
}}
|-
|}</includeonly>

See also