From Script | Spoken-Tutorial
Revision as of 12:00, 6 September 2022 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:01 Welcome to the spoken tutorial on creating new environments in LaTeX.
00:08 This tutorial will help the learners to

create or define new environments to get customized output.

00:15 redefine the existing environments.
00:18 To follow this tutorial,

You should have knowledge of commands that are necessary to create a document in LaTeX.

00:24 You should also have knowledge of compiling and producing a PDF output in LaTeX.
00:30 If not, please go through the relevant LaTeX spoken tutorials on this website.
00:37 To record this tutorial, I am using

Ubuntu Linux 14.04 operating system, TeXWorks 0.5

00:47 Just like new commands, we can define new environments.
00:51 As the name suggests the command newenvironment is used to create/define a new environment.
00:58 It is used to format blocks of text, generally.
01:04 New environment is a variation of executing few existing commands put together in a sequence.
01:10 Ensure that the custom environment you create, is not an already existing LaTeX environment.
01:18 The syntax to define a new environment is backslash newenvironment environment name within curly braces start commands within curly braces end commands within curly braces
01:32 Here the start commands are executed whenever the environment starts.
01:37 And end commands are executed whenever the environment ends.
01:42 Let us open the TeXWorks editor.
01:48 Pause the tutorial at this point.
01:50 Download and unzip the files provided in the Code Files link below the player.
01:57 You will see some LaTeX code given in the file newEnv.tex
02:06 We will copy and paste the first block of code from this file into our newly opened tex file.
02:27 Let’s try to understand the program.
02:30 Here \newenvironment{bluetext} means that we are defining a new environment called bluetext.
02:39 Here in the definition we center the text and colour it with blue using



02:51 While using it, we just give \begin{bluetext} and \end{bluetext} with the intended text between the two.
03:04 Save the file as newEnv.tex
03:15 Let us compile and see the output.
03:19 Observe the blue text in the output.
03:29 Now, we will see how to use parameters in the environments.
03:36 New environment with parameter is defined as

backslash newenvironment environment name within curly braces parameters in square bracket start commands within curly braces end commands within curly braces.

03:56 Let’s open a new file in TeXWorks.
04:03 Now switch to our downloaded code file.
04:16 We will copy the next block of code from our downloaded code file
04:26 and paste it into our new teX file.
04:32 Let us understand the code now.
04:34 Here in the given code, we are adding a title to the blue text by getting the title as an input parameter.
04:45 We have just added textbf textit hash 1 slash slash 12pt to the code given for the environment without parameter
05:01 We use it as “ begin bluetext My text in blue ” and the text,

and then “\end{bluetext}”

05:18 Save the file as newEnvp1.tex
05:31 Now compile and see the output.
05:44 We shall see the renewenvironment now.
05:51 renewenvironment is used to change or overwrite the existing environment.
05:56 The syntax for renewenvironment is

backslash renewenvironment environment name within curly braces start commands within curly braces end commands within curly braces

06:12 It’s quite similar to newenvironment.
06:16 Once again, we will open a new tex file.
06:28 We will copy and paste the last block of code from our downloaded file
06:48 into our newly opened tex file.
06:53 Let us understand the code.
06:59 renewenvironment itemize redefines the itemize environment.
07:06 It is defined as begin center large end center
07:12 This means that the text should be centered and made to large size.
07:18 Recall that the itemize environment creates a list according to the original definition.
07:24 Let’s see the usage.
07:27 The text given within \begin{itemize} and \end{itemize} should be converted to large size and centered according to our definition
07:42 Let us save the file as renewEnv.tex and compile the tex file.
07:59 Observe the output.
08:08 To summarise, we have learnt

newenvironment, newenvironment with parameters, renewenvironment

08:21 Create an environment itemizecolor, which takes the color (red, blue, yellow, green) as input

and creates a list in that color.

08:38 The video at the following link summarises the Spoken Tutorial project.

Please watch it.

08:46 The Spoken Tutorial Project Team :

Conducts workshops using spoken tutorials and Gives certificates to those who pass an online test

08:56 For more details, please write to us.
09:00 Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.

More information on this Mission is available at this link.

09:11 This is Ambika Vanchinathan signing off.

Thanks for joining.

Contributors and Content Editors