Difference between revisions of "LaTeX/C3/Customizing-columns-in-a-Table/English"
Ketkinaina (Talk | contribs) (Created page with "'''Title of the script:''' Customizing columns in a Table '''Authors''': Ambika Vanchinathan '''Keywords''': LaTeX, array, tabular, table formatting, fixed-width table, X-co...") |
|||
| Line 3: | Line 3: | ||
'''Authors''': Ambika Vanchinathan | '''Authors''': Ambika Vanchinathan | ||
| − | '''Keywords''': LaTeX, array, tabular, table formatting, fixed-width table, X-column type, bottom aligned, suffixing, video tutorial | + | '''Keywords''': LaTeX, array, tabular, table formatting, fixed-width table, X-column type, bottom aligned, suffixing, video tutorial. |
| + | |||
{|border=1 | {|border=1 | ||
| Line 13: | Line 14: | ||
'''Title Slide''' | '''Title Slide''' | ||
| − | || Welcome to this Spoken tutorial on''' Customizing columns in a Table | + | || Welcome to this Spoken tutorial on '''Customizing columns in a Table'''. |
|- | |- | ||
|| '''Slide 2''' | || '''Slide 2''' | ||
| Line 34: | Line 35: | ||
'''Pre-requisites''' | '''Pre-requisites''' | ||
| − | || To follow this tutorial, learners should have basic knowledge of LaTeX | + | || To follow this tutorial, learners should have basic knowledge of LaTeX. |
|- | |- | ||
|| '''Slide 5''' | || '''Slide 5''' | ||
| Line 44: | Line 45: | ||
1. array-eg.tex | 1. array-eg.tex | ||
| − | These files are provided in the Code Files link of this tutorial page. | + | These files are provided in the '''Code Files''' link of this tutorial page. |
| + | |||
|| The following code file is required to practice this tutorial. | || The following code file is required to practice this tutorial. | ||
| − | This file is provided in the Code Files link of this tutorial page. | + | This file is provided in the '''Code Files''' link of this tutorial page. |
|- | |- | ||
|| | || | ||
| Line 63: | Line 65: | ||
|- | |- | ||
|| Click the green Typeset button. | || Click the green Typeset button. | ||
| − | || Click the green Typeset button to run the code. | + | || Click the green '''Typeset''' button to run the code. |
Here is the output. | Here is the output. | ||
| Line 80: | Line 82: | ||
Run the code to see the output. | Run the code to see the output. | ||
| − | Spacing between columns increases when an '''array '''package is used. | + | Spacing between columns increases when an '''array ''' package is used. |
The vertical line '''|''' inserts more space due to array package. | The vertical line '''|''' inserts more space due to array package. | ||
| Line 101: | Line 103: | ||
Observe the following matrix code: | Observe the following matrix code: | ||
| − | Here''' l''', '''c''', and '''r''' align the content to the | + | Here ''' l''', '''c''', and '''r''' align the content to the left, center, and right respectively. |
|- | |- | ||
|| Uncomment line 7, 28 | || Uncomment line 7, 28 | ||
| Line 118: | Line 120: | ||
Let us comment line 27. | Let us comment line 27. | ||
| − | This command defines a custom-column-type, '''X '''with '''lcr '''alignment. | + | This command defines a custom-column-type, '''X '''with '''lcr ''' alignment. |
Let us run the code. | Let us run the code. | ||
| Line 136: | Line 138: | ||
line 42 | line 42 | ||
| − | Click the green Typeset button. | + | Click the green '''Typeset''' button. |
show the out put | show the out put | ||
| Line 147: | Line 149: | ||
'''m{}''' ensures content is vertically centered | '''m{}''' ensures content is vertically centered | ||
| − | Each column width is defined inside the braces | + | Each column width is defined inside the braces. |
| − | Note the fixed width '''m{3cm}, m{2cm} | + | Note the fixed width '''m{3cm}''', '''m{2cm}''',and '''m{1cm}'''. |
| − | '''m''' comes from the '''array '''package for | + | '''m''' comes from the '''array ''' package for fixed width definitions. |
| − | This also means that every entry is | + | This also means that every entry is centered. |
|- | |- | ||
|| comment line 54 | || comment line 54 | ||
| Line 163: | Line 165: | ||
show the output | show the output | ||
| − | '''Highlight: ''' | + | '''Highlight: line 61''' |
|| Let us comment line number 54 and | || Let us comment line number 54 and | ||
| Line 172: | Line 174: | ||
'''b{}''' aligns the text to the bottom of the cell. | '''b{}''' aligns the text to the bottom of the cell. | ||
| − | So we get | + | So we get bottom-aligned content using '''b{}''' in Table 2. |
|- | |- | ||
|| Comment line 73 | || Comment line 73 | ||
| Line 178: | Line 180: | ||
uncomment line 91 | uncomment line 91 | ||
| − | '''Highlight: ''' | + | '''Highlight: line 80''' |
| − | Click the green Typeset button | + | Click the green '''Typeset''' button. |
show the output | show the output | ||
| − | || Now comment line 73 and | + | || Now comment line 73 and uncomment line 91. |
| − | + | Run the code to see the output. | |
| − | + | ||
| − | 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. | Here first column entries are appended by a colon. | ||
| − | So, we get | + | So, we get Table 3 with Colon Suffix. |
|- | |- | ||
|| comment line 91 | || comment line 91 | ||
| − | Click the green Typeset button | + | Click the green '''Typeset''' button. |
show the output | show the output | ||
| Line 207: | Line 207: | ||
Run the code to see the output. | Run the code to see the output. | ||
| − | Greater than'''>{\bfseries} '''command applies bold text to the entire second column. | + | Greater than '''>{\bfseries} ''' command applies bold text to the entire second column. |
So, we get Table 4 with '''Bold Text''' in Column 2 | So, we get Table 4 with '''Bold Text''' in Column 2 | ||
| Line 228: | Line 228: | ||
'''Assignment''' | '''Assignment''' | ||
| − | Create a '''newcolumntype''' with a '''fixed width''' column of | + | Create a '''newcolumntype''' with a '''fixed width''' column of 4 cm |
Create a table using the newly created newcolumntype | Create a table using the newly created newcolumntype | ||
| − | || As an '''Assignment''' | + | || As an '''Assignment''', |
| − | Create an X '''columntype''' with a '''fixed width''' column of | + | Create an X '''columntype''' with a '''fixed width''' column of 4 cm. |
Create a table using the newly created X columntype | Create a table using the newly created X columntype | ||
| Line 240: | Line 240: | ||
'''Thank you''' | '''Thank you''' | ||
| − | || Thank you for joining | + | || Thank you for joining. |
|- | |- | ||
|} | |} | ||
Latest revision as of 17:31, 28 May 2025
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,
|
| Slide 3
System Requirements |
To record this tutorial, I am using:
|
| 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:
|
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. |