如何在乳胶中编号和引用“定义”

如何在乳胶中编号和引用“定义”

我想要以下 LaTeX 格式:

Definition 1 [apple]:
apple is a fruit.

Definition 2 [cat]:
cat is a fluffy animal. 
.
.

答案1

无需使用任何包,您就可以使用内置定理环境

\documentclass[10pt]{article}
\newtheorem{mydef}{Definition}

%use next two lines instead for non-italic alternative
%\newtheorem{preremark}{Definition}
%\newenvironment{mydef}{\begin{preremark}\upshape}{\end{preremark}}

\begin{document}    
\begin{mydef}\label{def:def444}
Here is a new definition
\end{mydef}

\begin{mydef}[Somebody]\label{def:def555}
Here is another new definition
\end{mydef}

That was Definition~\ref{def:def444} and Definition~\ref{def:def555}

\end{document}

在此处输入图片描述

答案2

在更低的层次上:

\documentclass{article}
\newcounter{definition}

\newcommand{\definition}[2]% #1 = name, #2 = definition
{\refstepcounter{definition}%
\par\noindent Definition \thedefinition\ [#1]:\newline #2\medskip\par}

\begin{document}
\definition{apple}{apple is a fruit.}\label{test1}
\definition{cat}{cat is a fluffy animal.}\label{test2}

 That was Definition \ref{test1} and Definition \ref{test2}.
\end{document}

反击和命令

相关内容