Jump to content

Requests for technical support from the VASP team should be posted in the VASP Forum.

Template:NB: Difference between revisions

From VASP Wiki
Csheldon (talk | contribs)
No edit summary
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#switch: {{{1}}}
{{#switch: {{{1}}}
  | mind      = {{{3|}}}{{{!}} style="border: 0px solid #35CABF; padding: 5px; background: #EDFAF9"
  | mind      = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 0px solid var(--vcyan); --box-emph-color: var(--vcyan); padding: 5px; color: var(--vdefault-text-nb); background: var(--vcyan-bg)"
   {{!}} '''<span style="color: #35CABF;">{{{4|Mind:}}}</span>''' {{{2}}}
   {{!}} '''<span style="color: var(--vcyan);">{{{4|Mind:}}}</span>''' {{{2}}}
   {{!}}}
   {{!}}}
  | deprecated = {{{3|}}}{{{!}} style="border: 0px solid #424242; padding: 5px; background: #E7E7E7"
  | deprecated = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 0px solid var(--vgrey); --box-emph-color: var(--vgrey); padding: 5px; color: var(--vdefault-text-nb); background: var(--vgrey-bg)"
   {{!}} '''<span style="color: #424242;">{{{4|Deprecated:}}}</span>''' {{{2}}}
   {{!}} '''<span style="color: var(--vgrey);">{{{4|Deprecated:}}}</span>''' {{{2}}}
   {{!}}}
   {{!}}}
  | tip        = {{{3|}}}{{{!}} style="border: 0px solid #3E70EA; padding: 5px; background: #D1DCFA"
  | tip        = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 0px solid var(--vblue); --box-emph-color: var(--vblue); padding: 5px; color: var(--vdefault-text-nb); background: var(--vblue-bg)"
   {{!}} '''<span style="color: #3E70EA;">{{{4|Tip:}}}</span>''' {{{2}}}
   {{!}} '''<span style="color: var(--vblue);">{{{4|Tip:}}}</span>''' {{{2}}}
   {{!}}}
   {{!}}}
  | warning    = {{{3|}}}{{{!}} style="border: 0px solid #A82C35; padding: 5px; background: #F6D5DB"
  | warning    = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 0px solid var(--vred); --box-emph-color: var(--vred); padding: 5px; color: var(--vdefault-text-nb); background: var(--vred-bg)"
   {{!}} '''<span style="color: #A82C35;">{{{4|Warning:}}}</span>''' {{{2}}}
   {{!}} '''<span style="color: var(--vred);">{{{4|Warning:}}}</span>''' {{{2}}}
   {{!}}}
   {{!}}}
  | important  = {{{3|}}}{{{!}} style="border: 0px solid #8342A4; padding: 5px; background: #EADEEF"
  | important  = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 0px solid var(--vpurple); --box-emph-color: var(--vpurple); padding: 5px; color: var(--vdefault-text-nb); background: var(--vpurple-bg)"
   {{!}} '''<span style="color: #8342A4;">{{{4|Important:}}}</span>''' {{{2}}}
   {{!}} '''<span style="color: var(--vpurple);">{{{4|Important:}}}</span>''' {{{2}}}
   {{!}}}
   {{!}}}
  | #default  = {{{3|}}}{{{!}} style="border: 1px solid #000000; padding: 5px; background: #FFFFFF"
  | #default  = {{{3|}}}{{{!}} class="vasp-dark-link-panel" style="border: 1px solid var(--vdefault-text); padding: 5px; background: var(--vdefault-bg)"
   {{!}} {{{2}}}
   {{!}} {{{2}}}
   {{!}}}
   {{!}}}

Latest revision as of 13:08, 15 April 2026

Purpose

This template draws various colored boxes which can be filled with user content. Should be used to replace instances of N.B.: or similar.

Parameters

 {{NB|<style>|<message>|<<indent>>|<<firstword>>}}
  • style: One of tip,deprecated,mind,warning,important, selects the box style, i.e. the color and the first word (see examples below). If style is not any of the words in the list, a black box without first word is drawn.
  • message: The content of the box (after the first word).
  • indent: (optional) Allows to indent the whole box with regular colon sign. Use multiple ":" signs to get any level of indentation. Can be left empty if no indentation is needed but firstword is required. Any other character than ":" may produce unexpected results!
  • firstword: (optional) Overrides the default first word for any of the predefined styles.


Examples

Regular usage

Without optional arguments these boxes are available:

 {{NB|tip|This is the clever way of doing it!}}

 {{NB|deprecated|This feature is deprecated and will be removed in the next release}}

 {{NB|mind|You can manually set this via '''SOME_TAG'''}}

 {{NB|warning|Never do this at home!}}

 {{NB|important|You should really consider this!}}

 {{NB|none|Just a box.}}

will produce






Special features

Replacing the first word while sticking to the warning color scheme (note the empty third argument):

 {{NB|warning|Really, really don't do this!||CAUTION!!!}}

Indenting with default first word:

 {{NB|tip|This is indented one level.|:}}
 {{NB|tip|This is indented two levels.|::}}

Problems and workarounds

The message cannot contain the "=" character because this has a special meaning for named template parameters. Therefore, we have to use the {{=}} template instead:

{{NB|tip|We highly recommend '''MY_TAG''' {{=}} 42}}

Note that using an indented box within a list requires the text after the box to be indented manually:

 * First item
 {{NB|tip|Second item is also great!|:}}
 :Some more text belonging to first item
 * Second item
  • First item
Some more text belonging to first item
  • Second item

Unfortunately, when using numbered lists the item counter is reset when a box is inserted and requires manual setting of the start value with the li value tag:

 # Option A
 {{NB|warning|Option B should be avoided!|:}}
 :Some more text belonging to first option
 # <li value="2"> Option B
  1. Option A
Some more text belonging to first option
  1. Option B