Toggle search
Search
Toggle menu
notifications
Toggle personal menu
Editing
Template:Truthtable/Documentation
Template page
Views
Read
Edit source
View history
associated-pages
Template
Discussion
More actions
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Template to put at the top of table declarations to standardise the appearance of truth tables. By default it will place the table "floating" on the left hand side. If you want the table to apear on the right side then use: <nowiki>{{truthtable|float=right}}</nowiki>. If you want the table to fill the whole width of the page, call the template as follows: <nowiki>{{truthtable|wide=1}}</nowiki>. Additionally, you can mark the table as sortable (i.e. if it's a table of sortable values, such as {{t|yes}} or {{t|no}}), by using the "sortable" parameter: <nowiki>{{truthtable|sortable=1}}</nowiki>. Text can be left-aligned in the table using <nowiki>{{truthtable|text left=1}}</nowiki>. Finally, extra styling can be added using the "style" parameter. '''Using the "wide" parameter is discouraged for normal situations: Truth tables should be left- or right-floated if that makes things look better.''' ==Parameters== * '''wide''': If a value is given (1, 0 or anything) it will make the table stretch to fit the area it is contained in. * '''sortable''': If a value is given, it allows columns to be sorted by clicking on the little icon within the header cell at the top of the column. **To change individual columns to be unsortable (for instance for images), use the "unsortable" class on the header cell. * '''text left''': If a value is given, text will be left-aligned, otherwise centre-aligned by default. * '''float''': A side on which to float the table ("left", "right" and "none" are the allowed values). If neither "float" nor "wide" are given "left" is the default. * '''style''': Additional style values are allowed; usage is simply the CSS values ''not'' surrounded by quotes. * '''class''': Additional CSS class names (separated by spaces) to apply to the table. ==Example== ===Not Wide=== <pre>{| {{truthtable}} ! Input One !! Input Two !! Output |- | {{No}}|| {{No}}|| {{Yes}} |- | {{No}}|| {{Yes}}|| {{Yes}} |- | {{Yes}}|| {{No}}|| {{Yes}} |- | {{Yes}}|| {{Yes}}|| {{No}} |}</pre> {| {{truthtable}} ! Input One !! Input Two !! Output |- | {{No}}|| {{No}}|| {{Yes}} |- | {{No}}|| {{Yes}}|| {{Yes}} |- | {{Yes}}|| {{No}}|| {{Yes}} |- | {{Yes}}|| {{Yes}}|| {{No}} |} ===Wide=== <pre>{| {{truthtable|wide=1}} ! Input One !! Input Two !! Output |- | {{No}}|| {{No}}|| {{Yes}} |- | {{No}}|| {{Yes}}|| {{Yes}} |- | {{Yes}}|| {{No}}|| {{Yes}} |- | {{Yes}}|| {{Yes}}|| {{No}} |}</pre> {| {{truthtable|wide=1}} ! Input One !! Input Two !! Output |- | {{No}}|| {{No}}|| {{Yes}} |- | {{No}}|| {{Yes}}|| {{Yes}} |- | {{Yes}}|| {{No}}|| {{Yes}} |- | {{Yes}}|| {{Yes}}|| {{No}} |} ===Symbols=== <pre>{| {{truthtable}} ! A !! NOT(A) |- | {{Off}} || {{On}} |- | {{On}} || {{Off}} |}</pre> {| {{truthtable}} ! A !! NOT(A) |- | {{Off}} || {{On}} |- | {{On}} || {{Off}} |} ===Full example=== <pre>{| {{truthtable|float=right|sortable=1|text left=1|style=font-size:1.5em}} |+ NAND Gate Truth Table ! Input One !! Input Two !! class="unsortable" | Output |- |data-sort-value="0"| {{off}}|| data-sort-value="0"| {{off}} || {{on}} |- |data-sort-value="0"| {{off}}|| data-sort-value="1"| {{on}} || {{on}} |- |data-sort-value="1"| {{on}} || data-sort-value="0"| {{off}} || {{on}} |- |data-sort-value="1"| {{on}} || data-sort-value="1"| {{on}} || {{off}} |}</pre> {| {{truthtable|float=right|sortable=1|text left=1|style=font-size:1.5em}} |+ NAND Gate Truth Table ! Input One !! Input Two !! class="unsortable" | Output |- |data-sort-value="0"| {{off}}|| data-sort-value="0"| {{off}} || {{on}} |- |data-sort-value="0"| {{off}}|| data-sort-value="1"| {{on}} || {{on}} |- |data-sort-value="1"| {{on}} || data-sort-value="0"| {{off}} || {{on}} |- |data-sort-value="1"| {{on}} || data-sort-value="1"| {{on}} || {{off}} |} <noinclude>[[Category:Template documentation|P]]</noinclude>
Summary:
Please note that all contributions to Turing Complete are considered to be released under the Creative Commons Attribution-ShareAlike (see
TuringComplete:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:No
(
edit
)
Template:Off
(
edit
)
Template:On
(
edit
)
Template:T
(
edit
)
Template:Truthtable
(
edit
)
Template:Yes
(
edit
)