CodeChef has many beautiful Discuss Forum features. This tutorial is for introducing newcomers to the various formatting that are available in CC Discuss. I’ve seen individual tutorials on formatting code or equations, but no topic on the entire available options. So I’m writing this topic for it to be that one place with all available formatting.
Basic:
The very basic formatting such as Boldface or Italics are available in GUI, and just a click away. You can also use ** text ** for boldface and * text * for italics. There is also an option to Hide Details with a drop-down, or adding an Image. You can quote someone’s text by selecting it, and clicking on the Quote
button, when it appears. You can also start polls if you want.
Mono-spaced font:
For formatting a piece of text (usually a part of a code) in mono-spaced font, wrap the piece inside `, like ` text `. Which would make it look like text
. You can also indent 4 spaces before you start a line, to make the entire line mono-spaced, but I prefer this.
Color-formatting Code:
The most important feature. As everyone here keeps saying, *Please format your code* when you post it. It's very simple. Just add \```, before and after a piece of code.```
\\ your code
```
Would Look Like
C++:
#include<iostream.h>
int main()
{
int n;
cin >> n;
cout <<< "Hello World " << n << endl;
}
Python:
for _ in int(input()):
n = int(input())
print("Hello World", n)
Hyperlinks:
To add a link, type [name](target web page). Example: This Topic
Links in onebox: (Thanks to @spaanse)
Just post the link in a line, and voila:
Enumeration:
Making a list is very simple. Just type the number and put a dot next to it for an ordered list, or type an * at the beginning of a sentence of an unordered list. To break out of a list, insert a blank line after the list.
Example
1. Item 1
1. Item 2
(or)
1. Item 1
2. Item 2
will result in:
- Item 1
- Item 2
* Item 1
* Item 2
will result in:
- Item 1
- Item 2
LaTeX:
The next important thing that you’d wish to learn is \LaTeX in CC Discuss. For posting mathematical symbols or equations, \LaTeX is your best bet. To start typing \LaTeX equations, just wrap your \LaTeX code around $
.
Examples
n → $n$
\alpha → $\alpha$
a^3 → $a^3$
A_i → $A_i$
A_{12} → $A_{12}$
\sqrt{x} → $\sqrt{x}$
\frac{a + c}{b} → $\frac{a + c}{b}$
\dfrac{a + c}{b} → $\dfrac{a + c}{b}$
(Be a sane person and use \dfrac
instead of \frac
)
Checkout more \LaTeX syntax here.
Big O:
Regular: O(n) $O(n)$
Fancy: \mathcal O(n) $\mathcal O(n)$
Tip: To add a blank space when inside \LaTeX, use \;
Summation:
$\sum\limits_{i=1}^{n}\dfrac{A_i*G_i}{A_i+B_i}$
\sum\limits_{i=1}^{n}\dfrac{A_i*G_i}{A_i+B_i}
Just in case, this is how you write integrals
$\int\limits_{1}^{\infin}\dfrac{x^2}{2x + 1} \cdot dx$
\int\limits_{1}^{\infin}\dfrac{x^2}{2x + 1} \cdot dx
The Escape Character:
Whenever you want to type an *
, but the formatter keeps making the text boldface or italics, you a \
before the *
. It tells the formatter to read the *
as a character, and not as a format specifier. The \
can be used with *
, $
, ```, or any format specifier.
Emojis!
To add an emoji, you can use the emoji button, or wrap the name of the emoji between :
:smile:
If you feel like I’ve missed something, do add it in the replies!
Happy Coding!