Difference between revisions of "Template:Mbox"

From Game Detectives Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(new "growth" icon)
Line 1: Line 1:
<span style="white-space: nowrap;">{{{|{{{1}}}}}}</span><noinclude>
+
<table style="{{{style|}}}" class="metadata plainlinks ambox {{#switch:{{{type|}}}
----
+
  | serious  = ambox-serious
This template prevents line breaks during HTML mathematicsIt is a practical alternative to excessive use of [[non-breaking space]]s (&#38;nbsp;).
+
  | content  = ambox-content
 
+
  | style    = ambox-style
==Use==
+
  | merge    = ambox-merge
In a math article, included math such as
+
  | notice  = ambox-notice
<pre>''f'': ''X'' × ''Y'' → [0, 1]</pre>
+
  | growth  = ambox-growth
may end up broken between lines. This can be fixed using nonbreaking spaces:
+
  | #default = ambox-notice
<pre>''f'':&#38;nbsp;''X''&#38;nbsp;×&#38;nbsp;''Y''&#38;nbsp;→&#38;nbsp;[0,&#38;nbsp;1]</pre>
+
}}">
However, this results in cumbersome source code which can be difficult to edit.  Using this template, the same result can be achieved with:
+
<tr>
<pre>{{mbox| ''f'': ''X'' × ''Y'' → [0, 1]}}</pre>
+
{{#ifeq:{{{image}}}|none
 
+
  | <!-- no image cell -->
===Dealing with equations===
+
  | <td class="ambox-image"> {{#switch:{{{image|{{{type|}}}}}}
Because of Wikipedia limitations on templates, mbox doesn't function as stated above if the math contains an equals sign.  In this case, the following syntax should be used:
+
    | serious  = [[Image:Stop hand nuvola.svg|40px]]
<pre>{{mbox|= 2''x'' + 3''y'' + 5''z'' = 7}}</pre>
+
    | content = [[Image:Emblem-important.svg|40px]]
Using |= instead of | also works for non-equations.
+
    | style    = [[Image:Broom icon.svg|40px]]
[[Category:Mathematics templates|{{PAGENAME}}]]
+
    | merge    = [[Image:Merge-split-transwiki default.svg]]
 +
    | notice  = [[Image:Info non-talk.png|40px]]
 +
    | growth  = [[Image:N write green black.svg|40px]]
 +
    | blank    = <!-- empty image cell -->
 +
    | #default = {{{image|[[Image:Info non-talk.png|40px]]}}}
 +
  }}</td>
 +
}}
 +
<td>{{{text}}}</td>
 +
{{#if:{{{imageright|}}}|
 +
  <td class="ambox-imageright"> {{{imageright}}} </td>
 +
}}
 +
</tr>
 +
</table><noinclude>
 +
{{template doc}}
 +
<!-- Add categories and inter-wikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Revision as of 04:59, 18 September 2007