# Help:Editing

In order to write new pages you need to have a login. Pages are created by by creating a cross-reference. For example, to write a new page called New Page you would write a cross-reference New Page and the act of clicking on the resulting link (New Page) would cause the new page to be created. If you want to have a link that differs from the name of the page, you write [[New Page|Name of the link]]

## Graphics

### Pictures

Graphics are uploaded by clicking on Upload file on the left of the screen. They are included on a page using:

[[File:ValueAttributesNumeric.png]]

The width can also be controlled:

[[File:HeatMap.png |600px]]

### Embedded images

These are wrapped in an HTML tag. For example:

<html><script src='https://numberseus.blob.core.windows.net/embed/30741/52704/d7b0e99d-1676-47fa-b392-5a4e31aa427d.js'></script></html>

## Structure (Category)

All pages should contain at least one category name at the bottom [[Category:Name]].

Pages documenting dialog boxes and other aspects of the user interface (e.g., a tab) should use [[Category:User Interface]]

Pages of code snippets for the different types of JavaScript should have [[Category:JavaScript Library]], as the plan is that users will be able to edit such pages.

Other pages should be organized by subject matter, using three (or more if required) tiers. See Structue of this Wiki for the basic overview and go to the Main Page or Categories in the sidebar for the detail.

When creating a new category, the category shown for the new category needs to be that for the level above it. For example, [[Category:Installing and Updating Q]] is itself a part of [[Category:Setup]], and this has its category set to Setup, whereas pages within Installing and Updating Q have [[Category:Installing and Updating Q ]]

Where appropriate, use multiple categories on the same page. However, do not put multiple categories where one is a sub-category of another as the software does this automatically.

### Categories and the Online Library

• Category:Rule Online Library is just for Rules that you want to be findable and selectable in Q.
• Category:R Online Library is just for R stuff (both QScripts and multiple-chunk-stuff) that you want to be findable and selectable in Q.
• Category:QScript Online Library is just for QScripts that you want to be findable and selectable in Q.
• Category:Automation Online Library is the union of all three.
• Pages that do not meet this description should not be in these categories.

## Q Versioning

Be explicit about versions when writing on a new or changed feature in Q. For example, a change in a feature should say how it is now, and how it used to be:

Q's default for '''Minimal sample size for testing''' is 2.  In [[Release Notes#1.1.0.0|Q 1.1]] and earlier versions, the default was 10.

Q's default for Minimal sample size for testing is 2. In Q 1.0.1 and earlier versions, the default was 10.

Another example for a new feature:

The Segments dialog is new in [[Release Notes#4.0.0.0|Q 4]].

The Segments dialog is new in Q 4.

 Observation was introduced in Q 4.6

Another style, less explicit:

{{Infobox
|data1 = ''Observation'' was introduced in [[Release Notes#4.6.0.0|Q 4.6]]
}}


Cross-references are created by entering [[Name]]. When you save, the link will go blue if the cross-reference exists and red otherwise. Clicking on a red link causes the cross-reference page to be created. Links to external pages will not have this automatic red if they do not exist.

The link to a cross-reference can be created so that the wording of cross-reference differs from the file being cross-reference. For example: [[Name of Cross-Reference|Click here]]

Where the link is to a category page, it is written as[[[[:Category:Category Name|Name shown on screen]]

To link to a section in the same page you can use [[#section name|displayed text]], and to link to a section in another page [[page name#section name|displayed text]].

Links to general web pages (e.g., surveyanalysis.org) are written with this syntax [http://surveyanalysis.org surveyanalysis.org]. When writing a link to surveyanalysis.org instead use [[surveyanalysis:page on that wiki]].

Related Online Training modules
Stacking data
Generally it is best to access online training from within Q by selecting Help : Online Training

Online training tutorials related to a particular topic should generally be listed in an a box at the top of the page. For example, the following code generates the box shown at the right:

{{Infobox
|header1 = Related Online Training modules
|data2   = [http://www.q-researchsoftware.com/training/ReferencedLesson.aspx?id=173 Stacking data]
|data3  = <small>Generally it is best to access online training from within Q by selecting '''Help : Online Training'''</small>
}}



[mailto:support@q-researchsoftware.com support]



## Quotes and quotations

When a single word or term is quoted it is quoted in single quotes (e.g., 'dog'). When speach or text is quoted it is quoted in double quotes (e.g., "How would you rate the following brands of car?").

## Footnotes and references

<ref>Cochran, W. G. (1977). Sampling Techniques, Third Edition. New York, Wiley.</ref>


References are added at the bottom of the page using:

== References ==
{{reflist}}



Footnotes are created using:

<ref group="note">Possibly irrelevant detail.</ref>


And they are compiled using:

==Notes==
{{Reflist|group=note}}


## Page names, headings and capitalization

Page names should be written with capitals preceding each word except where it looks silly (e.g., 'New Page Name').

Within a page, headings should only use capitals for the first word, except where referring to specific things. (The only exception to this is on the home page, where the sub-headings are capitalized to match to the category names).

Levels of heading are indicated by == signs.

== Top level heading ==


Where there are lots of fields, buttons and/or options on a page, they can be included under a sub-heading of Buttons, options and fields and other related topics under See also.

## Formatting

Technical terms should, in general, be cross-referenced but where this is not desirable instead use italics (''name'').

Options, buttons, fields, menus and items are showng with an appropriate cross-reference, or, in bold '''name'''.

Text that appears on tables, file names and things to be typed are shown in this style, which is created using:

<tt>'''the thing to show'''</tt>

you can also set the color of the background behind text.

### JavaScript

JavaScript is shown with syntax highlight:

var x = 3;
alert(x * 3);

and is written like this:

<syntaxhighlight>
var x = 3;
</syntaxhighlight>


See SyntaxHighlight_GeSHi for more formatting help, including changing the highlight language (our default is JavaScript).

### R

R is shown with syntax highlight:

Test <- function(x, y)
{
return (x^2 + y)
}


and is written like this:

<syntaxhighlight lang="rsplus">
Test <- function(x, y)
{
return (x^2 + y)
}
</syntaxhighlight>


See SyntaxHighlight_GeSHi for more formatting help, including changing the highlight language (our default is JavaScript).

## Style guide

When referring to objects in menu:

• Use > to indicate sub-menus.
• Do not type elipses (i.e., ...).

For example, save as is shown as File > Save Project As.

### Page names

Page names should be written with capitalization of the first letter in every word (e.g., "This Is The Name Of The Page").

### Section names

Section names should only capitalize:

• The first letter.
• Things that are ordinarily capitalized.

For example: "Modifying the Value Attribute settings".

## Tables

### Cell alignment for whole table

{| class="wikitable" style="text-align:center"
|-


### Cell alignment for specific cell

!	!! Professional<br>Boxing !! 	This<br>Week !! 	Today !! 	World of<br>Sport !! 	Grandstand !! 	Line-Up !! 	Match of<br>the Day !! 	Panorama !! 	Rugby<br>Special !! 	24 Hours
|-
|align="right"| '''Professional Boxing'''	|| 1.0 || 	.1 || 	.1 || 	.5 || 	.5 || 	.1 || 	.5 || 	.2 || 	.3 || 	.1
|-


## Formulas

The formula $\displaystyle{ f(x) = x^2\,\! }$ is written using:

$f(x) = x^2\,\!$


## Redirecting pages

You can create a redirection on page by replacing its contents with #REDIRECT [[target]]

At the top of the page enter __NOTOC__

To edit the links that appear on the left, use the special MediaWiki:Sidebar page.

## Including Text from Other Pages

To insert the contents of another page into the current page, use the notation {{:Page Name}}.

## Boilerplates

### Writing pages for the online library

Search in OneNote for 'Wiki Page Template' for boilerplates.

#### Hiding text from the Online Library

<div class="notinq">The stuff to hide</div>

#### Hiding text on standard R item help pages in Q and Displayr

This can be done using a div or a span with the class onlyindisplayr or the class notindisplayr. Some examples:

<span class="onlyindisplayr">This will be hidden from the default wiki view and the previews in Q. But will show up in help pages linked from Displayr Standard R items.</span>
<span class="notindisplayr"> This will be hidden from Standard R item help pages in Displayr. But will show up in all other places the wiki is linked.</span>


#### Excluding a page from the Online Library

<span data-hide-from-q="true"></span>

### QScript Examples Library

General explanation XX

This example can be run in <tt>C:\Program Files\Q\Examples\XX.sav</tt> (this may be located on a different place on your computer depending upon how Q was installed).

<syntaxhighlight>
XX
</syntaxhighlight>

* [[:Category:QScript|QScript]] for an explanation of how to run this code.
* [[:Category:QScript Examples Library|QScript Examples Library]] for other examples.
* [[:Category:QScript Reference|QScript Reference]] for technical information.
* [[:Category:JavaScript|JavaScript]] for information about the JavaScript programming language.
* [[:Category:Table JavaScript and Plot JavaScript|Table JavaScript and Plot JavaScript]] for tools for using JavaScript to modify the appearance of tables and plots.
* [[:Category:JavaScript Variables|JavaScript Variables]] for detail on how to create new variables in the [[Variables and Questions tab]] using JavaScript.

[[Category:QScript Examples Library]]


### Table JavaScript and Plot JavaScript Examples Library

General explanation XX

This example can be run in <tt>C:\Program Files\Q\Examples\XX.sav</tt> (this may be located on a different place on your computer depending upon how Q was installed) by creating a table XX

<syntaxhighlight>
XX
</syntaxhighlight>


## Learning more about editing pages

Generally the best way to learn how to use WikiMedia (this software) is to edit or view the source of a page. Alternatively, consult the User's Guide for information on using the wiki software.