# [Tutorial] Formatting in CodeChef Discuss

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.




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)


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:

1. Item 1
2. Item 2
* Item 1
* Item 2
will result in:

• Item 1
• Item 2

# 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!

28 Likes

Does three backticks auto-detect language?
I normally do

 c++
code



To highlight it as C++

Also if you want to quote anything that is not on this forum use

> quote


Which will produce

quote

4 Likes

Oh and of course the link on a line of it’s own (which is called a onebox):

By using:

https://discuss.codechef.com/t/tutorial-formatting-in-codechef-discuss/72834
https://en.wikipedia.org/wiki/Competitive_programming

2 Likes

It does auto detect the language. I think it switches to cpp the moment it sees cout. But I guess it’s better be sure by specifying the language.

Oh I didn’t know about the quote. Thanks!

2 Likes

Simple: O(n) by $O(n)$
Fancy: \mathcal{O}(n) by $\mathcal{O}(n)$

6 Likes

Can you also add summations to \LaTeX section?
\displaystyle\sum\limits_{i=1}^{n}\dfrac{A_i*G_i}{A_i+B_i}
$\displaystyle\sum\limits_{i=1}^{n}\dfrac{A_i*G_i}{A_i+B_i}$

1 Like

To make the \LaTeX look better:
This is fancy: \displaystyle\sum\limits_{i=1}^{n}\dfrac{A_i*G_i}{A_i+B_i}
Just add $\displaystyle$ before. For example:

This is bad: \int^{13}_{10} 2x \ dx ($\int^{13}_{10} 2x \ dx$)
This is nice (literally): \displaystyle\int^{13}_{10} 2x \ dx ($\displaystyle\int^{13}_{10} 2x \ dx$)

5 Likes

Good tutorial! I add one more, centered equation like this:

H = \dfrac{p^2}{2m} + V

The equation is between $$symbol but the symbols and equation not in the same line. Something like this: $$
H = \dfrac{p^2}{2m} + V

9 Likes

You have written it the opposite way, it should be * text * for italics, and ** text ** for boldface.

1 Like

Thanks for pointing that out!

2 Likes

That is cool!

1 Like

It also supports html tags.
So, you can use the following as well:

<strong> word </strong>   word
10<sup>3</sup>   for   103
&nbsp;` for good spacing.

And the list goes on …

1 Like

This needs to be sticky!

1 Like