General ⇒ how can I make my own environment
how can I make my own environment
Where can I find a guide of how can I create my own environment which is based on an exciting one?
Please note, I don't want to change the old environment but I simply want to create new one which "inherit" some of the old one properties?
Thanks.
Yotam
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
how can I make my own environment
I'm not aware of a special guide but every book about LaTeX basics should describe how to create own environments. If you want to know more about existing environments take a look at the class files or the latex.ltx kernel file. Its sources are described in source2e (web search for source2e.pdf).
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
how can I make my own environment
- I want to shift the numbering of the equation one line down.
- I want to be able to refer to the equation with it's own counter using \cref I read some documentation about it.
- I think I need it to be a float because I want latex to move to the next page the equation if the number and the equation are separated.
Code: Select all
%Creating counter for reactions
\newcounter{reaction}[chapter]
\newenvironment{reaction}[1]{
\refstepcounter{reaction}
\begin{equation*}
\ce{#1}
\end{equation*}
\begin{flushright}
reaction (\arabic{section}.\arabic{reaction})
\end{flushright}
}
{}
Re: how can I make my own environment
localghost. I know you placed a solution to this in another thread but I don't want to blindly paste parts but rather to understand our code.
Yotam