Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

latexteada
latexteada

Posted on

     

LaTeX: The theorem Like Environment

Hello, how are you? :)

In this post I talk about

  • How to declaretheorem like environments

Introduction

In past post I have talked about macros, but these just are instructions, they are shortens to do something bigger and avoid writing the same instruction many times, what about if we want to create environments?

Thetheorem like environment is an environment which you can personalize to be numbered according to a certain enumeration, this is useful because you can have the same format to different mathematical proofs, theorems, lemmas, etc, and instead of declaring or writing the same instruction, you just call the environment and it's all

Thetheorem environment

We say that it is atheorem environment because it is the name of the command, as you are about to notice, but you can create Lemmas, Proofs, and many other stuff, it is just a matter that you put the appropriate name to that

The general instruction is

\newtheorem{name}{print}[numbered]
Enter fullscreen modeExit fullscreen mode

Where

  • name is the name of the environment
  • print is the word to be shown in the document
  • numbered is the sectional unit based onwhich the environments is to be numbered (this is optional, you can see it because it has[] instead of{}

An example

Image description

Produces

Image description

See? the environment puts a default enumeration, in this case, it has not any reference, but, innumbered we can put according to what we want that enumeration, for example

  • section for section
  • subsection for subsection

Image description

Produces

Image description

You can play with this!!

Referencing to atheorem

Remember that we saytheorem because it is the name of the command

Do you remember the instructionref andlabel, if not you can check themhere andhere, there are good news, you can refer theorems too, the suggested way to call theorems and mathematical stuff is

\eqref{name}
Enter fullscreen modeExit fullscreen mode

Remember to import theamsmath package in the preamble

Wherename is the name of the label, let's see some examples

Image description

Produces

Image description

Did you see, theeqref adds some parentheses

Some conventions to use whilelabeling thetheorem are

  • thm theorem
  • prop proposition
  • dfn definition
  • prf proof
  • cor corollary
  • princ principle
  • lem lemma

Useful Tricks

Names of thetheorems

What if we want to be more specific in a theorem? What if we want to add aname, well we have two options, use[] or()

Image description

Produces

Image description

Delete the cursive

When we are using any math theorem it puts the mathematical equations in cursive, and thetheorems are in cursive, it is a mess because sometimes it is difficult to differentiate between normal text and math stuff, so, if we want to delete the cursive in thetheorems we just need to add

\usepackage{amsthm}\theoremstyle{definition}
Enter fullscreen modeExit fullscreen mode

Image description

Produces

Image description

We need to import theamsthm package and if we put the environment before\theoremstyle{definition} it won't be affected, but if we put the environment after it it will be affected

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Hello, this is where I am going to give some base briefs of LaTeX
  • Location
    México
  • Work
    Student
  • Joined

More fromlatexteada

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp