LaTeX/C3/Customizing-columns-in-a-Table/English

From Script | Spoken-Tutorial
Revision as of 17:31, 28 May 2025 by Madhurig (Talk | contribs)

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

Title of the script: Customizing columns in a Table

Authors: Ambika Vanchinathan

Keywords: LaTeX, array, tabular, table formatting, fixed-width table, X-column type, bottom aligned, suffixing, video tutorial.


Visual Cue Narration
Slide 1

Title Slide

Welcome to this Spoken tutorial on Customizing columns in a Table.
Slide 2

Learning Objectives

In this tutorial, we will learn to,
  • Create and customize tables with fixed column width using array package
  • Align text with text entries in a table
  • Add a suffix and make a complete column text bold
Slide 3

System Requirements

To record this tutorial, I am using:
  • Ubuntu Linux OS version 22.04
  • TeXworks version 0.6.6
Slide 4

Pre-requisites

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

Code files

The following code files are required to practice this tutorial:

1. array-eg.tex

These files are 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{array}

This command imports the array package.
Highlight :

lines 14 to 22

These lines create a simple table.
Click the green Typeset button. Click the green Typeset button to run the code.

Here is the output.

uncomment line 5

Highlight 5:

\usepackage{array}

click the typeset button

Show the output

Let us uncomment line number 5.

Run the code to see the output.

Spacing between columns increases when an array package is used.

The vertical line | inserts more space due to array package.

comment line 24

uncomment line 34

Highlight:

line 27 to 32

click the typeset button and show the output

Let us comment line 24 and

uncomment line 34.

Let us run the code

Observe the following matrix code:

Here l, c, and r align the content to the left, center, and right respectively.

Uncomment line 7, 28

comment line 27

Highlight7: \newcolumntype{\X}{lcr}

Click the green Typeset button.

Show the output

highlight the code.

Let us uncomment line 7 and line 28.

Let us comment line 27.

This command defines a custom-column-type, X with lcr alignment.

Let us run the code.

Here, the output is the same as the previous one.

So, instead of lcr we can use X to simplify the code.

This is X column type

comment line 34

uncomment line 54

Highlight:

line 42

Click the green Typeset button.

show the out put

Now let us comment line 34.

and uncomment line 54.

Lets run the code to see the output.

m{} ensures content is vertically centered

Each column width is defined inside the braces.

Note the fixed width m{3cm}, m{2cm},and m{1cm}.

m comes from the array package for fixed width definitions.

This also means that every entry is centered.

comment line 54

uncomment line 73

Click the green Typeset button.

show the output

Highlight: line 61

Let us comment line number 54 and

uncomment line number 73.

Run the code to see the output

b{} aligns the text to the bottom of the cell.

So we get bottom-aligned content using b{} in Table 2.

Comment line 73

uncomment line 91

Highlight: line 80

Click the green Typeset button.

show the output

Now comment line 73 and uncomment line 91.

Run the code to see the output.

Less than colon(<{:}) automatically appends colon(:) to the end of each entry in the specified column.

Here first column entries are appended by a colon.

So, we get Table 3 with Colon Suffix.

comment line 91

Click the green Typeset button.

show the output

Highlight: line 98

Now let us comment line 91.

Run the code to see the output.

Greater than >{\bfseries} command applies bold text to the entire second column.

So, we get Table 4 with Bold Text in Column 2

Slide 6

Summary

In this tutorial, we have learnt to:

  • Create and customize tables with fixed column width using array package
  • Align text with text entries in table
  • Add a suffix and make a complete column text bold
With this we come to the end of this tutorial.

Let us summarise.

Slide 7

Assignment

Create a newcolumntype with a fixed width column of 4 cm

Create a table using the newly created newcolumntype

As an Assignment,

Create an X columntype with a fixed width column of 4 cm.

Create a table using the newly created X columntype

Slide 8

Thank you

Thank you for joining.

Contributors and Content Editors

Ketkinaina, Madhurig