Difference between revisions of "Wiki:Editing"

From Wiki
Jump to navigation Jump to search
(→‎In-line elements: old, deprecate <cmd> was removed from all pages using Replace text)
Line 91: Line 91:
  
 
=== Linking to source files ===
 
=== Linking to source files ===
 +
There are two templates to link to online copies of the files contained in the <code>texmf-context</code> tree of the ConTeXt distribution.
  
Practically all of ConTeXt's source files are stored in the directory {{code|.../tex/context/base/mkiv}}. There are two templates to link to online copies of the source files.
+
Practically all of ConTeXt's actual source files are stored in the directory {{code|tex/context/base/mkiv}}
  
Link to the most recent version (recommended):
+
Link to the file in {{code|tex/context/base/mkiv}} directly:
 
* '''You type:''' <nowiki>{{src|type-akb.tex}}</nowiki>
 
* '''You type:''' <nowiki>{{src|type-akb.tex}}</nowiki>
 
* '''Links to:''' https://source.contextgarden.net/tex/context/base/mkiv/type-akb.tex
 
* '''Links to:''' https://source.contextgarden.net/tex/context/base/mkiv/type-akb.tex
 
* '''Looks like:''' {{src|type-akb.tex}}
 
* '''Looks like:''' {{src|type-akb.tex}}
  
Link to the version stored on contextgarden.net:
+
But the ConTeXt distribution also contains various other files, like documentation and scripts.
* '''You type:''' <nowiki>[[source:type-akb.tex| type-akb.tex]]</nowiki>
+
 
* '''Links to:''' http://source.contextgarden.net/type-akb.tex
+
Link to any file in the ConTeXt distribution:
* '''Looks like:''' [[source:type-akb.tex|type-akb.tex]]
+
* '''You type:''' <nowiki>[[source:mtxrun.lua|mtxrun.lua]]</nowiki>
 +
* '''Links to:''' http://source.contextgarden.net/mtxrun.lua
 +
* '''Looks like:''' [[source:mtxrun.lua|mtxrun.lua]]
 +
 
 +
The software at http://source.contextgarden.net/ will find the actual file location for you.
 +
 
 +
Please use the <nowiki><code>{{src|}}</code></nowiki> format for pointing to actual ConTeXt source files.
  
 
=== Linking to other sections of the wiki ===
 
=== Linking to other sections of the wiki ===

Revision as of 13:38, 9 August 2020

This page is about editing pages on this wiki in general. For editing command reference pages, also see Help:Reference.


TODO: Warning: explain here the use of ToDo category. (See: To-Do List)


General

May I edit pages without signing in?

Yes, but you are highly encouraged to sign in before contributing if possible. Even if your account has a username/nickname with no resemblance to your real name, this is still better than not signing in at all while editing.

What commands do I use to edit this wiki?

In order of increasing generality, have a look at:

How do I sign when posting a comment?

  • You type: --~~~ (three tildes)
  • Looks like: --Esteis
  • You type: --~~~~ (four tildes)
  • Looks like: --Esteis 16:37, 14 June 2012 (CEST)

How do I edit the Main Page?

The Main Page is protected to avoid spammers. Only wiki administrators are allowed to edit that page. You can leave your change request in the Talk:Main Page page.

In-line elements

ConTeXt commands

Use the cmd template for command names in running text:

  • {{cmd|mycommand}},
  • {{cmd|mycommand|parameters, text, etc.}}

That way, you get an automatic link to e.g. \startnarrower, or \startnarrower[middle].

You type You see
  • {{cmd|startitemize}}
  • {{cmd|startnarrower|[middle]}}
  • {{cmd|startcolumns|2=[n=4]}}
  • {{cmd|section|{First section}}}
Forgetting the pipe or the '2=' leads to this:
  • {{cmd|startnarrower[middle]}}
  • {{cmd|startcolumns|[n=4]}}
  • {{cmd|section{First section}}}
  • [[Command/startnarrower[middle]|\startnarrower[middle]]]
  • \startcolumns
  • [[Command/section{First section|\section{First section]]}

Linking to parameter description pages

In ConTeXt many key=value parameters are common across commands, so this wiki intends to have separate description pages for those parameters. Those are not linked from the text, in general, but they are linked from the syntax tables on command description pages. (Example.) The linking is achieved with {{key|alternative}}, which expands to [[Command/keyword:alternative]]. Nearly all the target pages do not exist yet, but don't let that stop you from linking to them. We'll get around to filling them in.

Other inline code

For in-line markup of code, commands, parameters, etc. in running text use {{code|some code}}. If there are equality signs in the code, use e.g. {{code|1=some=code}}, because the wiki templating software interprets all text up to the first equality sign as a template parameter name. Please do use the code template instead of the <code> tags, as templates are much easier to change.

You type You see
In the following examples we use the 
{{cmd|framed}} command with the 
parameters {{code|1=background=color}} 
and {{code|1=offset=1cm}}.

In the following examples we use the \framed command with the parameters background=color and offset=1cm.

Linking to source files

There are two templates to link to online copies of the files contained in the texmf-context tree of the ConTeXt distribution.

Practically all of ConTeXt's actual source files are stored in the directory tex/context/base/mkiv

Link to the file in tex/context/base/mkiv directly:

But the ConTeXt distribution also contains various other files, like documentation and scripts.

Link to any file in the ConTeXt distribution:

The software at http://source.contextgarden.net/ will find the actual file location for you.

Please use the <code>{{src|}}</code> format for pointing to actual ConTeXt source files.

Linking to other sections of the wiki

Block elements

Displaying ConTeXt output (and source)

This wiki allows you to type ConTeXt code to obtain a PNG of the resultant output, with extraneous whitespace cropped. This is very useful for including in-page examples. Below are two simple ones; for more, see Help:Context.

You type You see
<context>
The wiki is using ConTeXt Mark IV: \crlf
\contextversionnumber
</context>
<context source=yes text="This produces:">
The wiki still uses ConTeXt Mark IV: \crlf
\contextversionnumber
</context>
The wiki still uses ConTeXt Mark IV: \crlf
\contextversionnumber

This produces:


Displaying a ConTeXt command syntax

If you want to show the calling convention(s) of a ConTeXt command, you can use <syntax> ... </syntax>. This is particularly useful in a "Command" page.

The <syntax> tag accepts two attributes:

  • To get the syntax for a ConTeXt environment like itemize, use the name of the command that starts the environment.
  • Some ConTeXt commands and environments have multiple variants with different arguments.If you want only a specific variant of such a command or environment, you can add variant=.
You type You see
<syntax>page</syntax>
\page[...,...]
[...,...]inherits from \pagebreak

<syntax>startitemize</syntax>
\startitemize[...,...][...=...,...] ... \stopitemize
[...,...]inherits from \setupitemgroup
...=...,...inherits from \setupitemgroup
instance of startitemgroup, generated by \defineitemgroup

<syntax variant='direct'>cite</syntax> 
\cite{...}
{...}reference

<syntax>cite</syntax> 
\cite[...=...,...][...]
referencereference
alternativedefault category entry short page num textnum year index tag keywords author authoryears authornum authoryear
beforecommand
aftercommand
leftcommand
rightcommand
...=...,...inherits from \setupbtx
[...]reference

\cite[...=...,...][...=...,...]
referencereference
alternativedefault category entry short page num textnum year index tag keywords author authoryears authornum authoryear
beforecommand
aftercommand
leftcommand
rightcommand
...=...,...inherits from \setupbtx
keyvalue

\cite[...][...]
[...]default category entry short page num textnum year index tag keywords author authoryears authornum authoryear
[...]reference

\cite{...}
{...}reference

Displaying TeX or ConTeXt code alone

For displaying TeX and ConTeXt code use <texcode> ... </texcode>.

You type You see
<texcode>
\def\person#1#2{{\em #1 (#2)}}

\setupcolors [state=start]
\framed [background=color,
         backgroundcolor=green,
         offset=1cm ]{hello world!}
</texcode>
\def\person#1#2{{\em #1 (#2)}}

\setupcolors [state=start]
\framed [background=color,
         backgroundcolor=green,
         offset=1cm ]{hello world!}

Displaying XML

For presenting XML source use <xmlcode> ... </xmlcode>.

You type You see
<xmlcode>
<?xml version="1.0"?>
<TeXML>
  <env name="text">
    Hello World
  </env>
</TeXML>
</xmlcode>
<?xml version="1.0"?>
<TeXML>
  <env name="text">
    Hello World
  </env>
</TeXML>

Displaying other verbatim text

To dispay other verbatim text use <pre> ... </pre>.

You type You see
<pre>
This is some text and some code.

\unprotect
\def\!test{alfa} 
\protect 
</pre>
This is some text and some code.

\unprotect
\def\!test{alfa} 
\protect