LaTeX/C3/Adding-Colour-to-LaTeX-Documents/English

From Script | Spoken-Tutorial
Revision as of 12:18, 12 November 2025 by Ketkinaina (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of the script: Adding Colour to LaTeX Documents

Authors: Ambika Vanchinathan

Keywords: LaTeX, xcolor package, background color, textcolor, pagecolor, nopagecolor, fcolorbox, video tutorial

Visual Cue Narration
Slide 1

Title Slide

Welcome to this spoken tutorial on Adding Colour to LaTeX Documents.
Slide 2

Learning Objectives

In this tutorial, we will learn to
  • Use the xcolor package
  • Apply colour to text and page background
  • Colour a specific text and
  • Colour Math equations
Slide 3

System Requirements


To record this tutorial, I am using:

  • Linux Mint OS version 21.3
  • TeXworks Editor version 0.6.6
To record this tutorial I am using the following setup.
Slide 4

Pre-requisites

To follow this tutorial, learners should have basic knowledge of LaTeX.
Slide 5

Code files

The following code file is required to practice this tutorial:

1. xcolor-eg.tex

This file is provided in the Code Files link of this tutorial page.

The following code file is required to practice this tutorial.

This file is provided in the Code Files link of this tutorial page.

Let us get started.
Highlight :

\usepackage{xcolor}

This command imports the xcolor package.
Click the green Typeset button to run the code

Use XeLatex to typeset.

Show the output

Click the green Typeset button to run the code.

The output shows text, table and math equation in black colour.

Let us add colour to the text.

Uncomment the line 11

Run the code and show the output

Uncomment line 11.

Run the code

Output shows text, math equation and section heading in blue colour.

Highlight :

line 11

To colour the text, we use the \color{} command.

color command takes the color name as its argument.

Here we have given blue.

Uncomment the line 13

Run the code and show the output

Uncomment line 13.

Run the code.

Output shows text and section title in lime colour.

Highlight :

line 13

click the typeset button

Show the output

This command changes the colour to lime.

The previous line remains in blue colour.

This command takes effect for all the text from here onwards.

Let us see how to change the background colour.

uncomment the line 15

Run the code and show the output

Uncomment line 15.

Run the code.

Output shows gray coloured background for the entire document.

Highlight:

line 15

\pagecolor command changes the background colour of the page.

This command takes the colour name as its argument.

Here it is specified as gray.

Let us see some more options.

uncomment line 17

Run the code

show the output

Uncomment line 17.

Run the code

We see some text in violet colour in the output.

Highlight:

line 17

The command \textcolor takes 2 arguments.

The first one is color and the second one is the actual text to apply the color.

Here violet is chosen for the given text.

Scope of the textcolor command is only for the text that is within the braces.

So, the text outside the braces will be in its original colour.

point to the output in lime colour Here it is shown in lime colour.

Let us see how to remove the background colour of the page.

Uncomment the line 19

Run the code

show the output

Uncomment line 19.

Run the code.

Now we see that the background colour is removed in the output.

Highlight: line 19 \nopagecolor command removes the page colour or gives no pagecolor to the background.

This takes effect from the current page.

Uncomment the line 21, 25

Run the code

show the output

Uncomment lines 21 and 25.

Run the code.

The output shows the text colour changing to teal.

Highlight: line 21 Here we have changed the text colour to teal.
show the output The math equation has also changed to teal colour.
Highlight:

line 21, 23

\color{teal } command has changed the text and math equation to teal colour.
Slide 6

Summary

In this tutorial, we have learnt to:

  • Use the xcolor package
  • Apply colour to text and page background
  • Colour a specific text and
  • Colour Math equations
With this we come to the end of this tutorial.

Let us summarise.

Slide 7

Assignment

As an Assignment,

Create a page with background colour blue and text in white colour.

Slide 8

Thank you

Thank you for joining

Contributors and Content Editors

Ketkinaina