Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to write a sentence that is centered and numbered automatically at the end. If what I am trying to type is just an equation, \begin{equation} works very nicely. However, since what I write involves a lot of words, I do not want to use \begin{equation}. Right now, all I can think of is using \textrm every time I write a regular word, but there must be another solution. As we keep the automatic numbering, is there any way to do what I am trying to do?

The following is the sample. Appreciate it.

\documentclass{article}
\begin{document}
\begin{equation}
\textrm{The derivative }y'\textrm{ of }y=\ln x\textrm{ is }y'=\frac{1}{x}
\end{equation}
\end{document}
share|improve this question

2 Answers 2

up vote 15 down vote accepted

You should type that like any other math component, only in text with interspersed math:

enter image description here

\documentclass{article}
\usepackage{amsmath,lipsum}
\begin{document}
\lipsum[1]
\vspace{\dimexpr-\abovedisplayskip+\abovedisplayshortskip}% May be needed
\begin{equation}
  \text{The derivative $y'$ of $y = \ln x$ is $y' = \tfrac{1}{x}$.}
\end{equation}
\lipsum[2]
\end{document}

You may wish to use a shorter space above, depending on the \abovedisplayshortskip depending on how the previous paragraph ends.

share|improve this answer
    
This works great as well. Thank you for the response. –  BzTAK178 May 5 at 22:57

You can use \mbox inside equation.

\documentclass{article}
\usepackage{amsmath} % recommended for math

\begin{document}

\begin{equation}
\mbox{The derivative $f'(x)$ of $f(x)=\log x$ is $f'(x)=\dfrac{1}{x}$}
\end{equation}

\end{document}
share|improve this answer
    
Works like a magic. Thank you very much. –  BzTAK178 May 5 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.