Math & ScienceHow to have textual sentences numbered as formulas?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

How to have textual sentences numbered as formulas?

Post by ks-zadeh »

I want to have also textual sentences that are longer than one line embedded (or included?) in the consecutive numbering of formulas. Unfortunately I am unable to find out how to do that. I would be grateful for any tip. The problems that arise, for example by using the environments eqnarray or gather are: (i) each line must be entered as a separate item to the effect that no justification is possible and (ii) the lines have the spacing of formulas that is wider than that of body text. That looks ugly. What I would like to have is something like quotation (in the quotation environment) plus numbering as a formula. It must in addition assume a lebel in order to support ref and pageref.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to have textual sentences numbered as formulas?

Post by frabjous »

What about something like this:

Code: Select all

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext} % for auto-generating text
\usepackage{amsmath} % for \text command
\begin{document}
\blindtext
\begin{equation}
\text{\parbox{.85\textwidth}{\blindtext}}
\end{equation}
\blindtext
\end{document}
Modify as you see fit. (Probably good to define a command for it.)

I can think of other solutions involving \refstepcounter and minipages, which might be more suitable, especially if you wanted a distinct counter from the equation counter.
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to have textual sentences numbered as formulas?

Post by ks-zadeh »

Many thanks. Did you test the program that you suggest? I have not yet succeeded. But I'll still try. As far as I understand the blindtest package from its description one can create texts thereby. But I want to use and have numerated by LaTeX my own texts (particular sentences like in a philosophy book). No, I do not want a second number series separate from the enumeration of formulas. That would be confusing. Here is an example for what I want.

Suppose someone has arrived in the first three chapters of his book at a result that he summarizes as follows:

All AIDS patients have HIV infection. Antony
Perkins has AIDS. But he is not HIV infected. These
two sentences are inconsistent. \label{aids}

He now wants to have the above set of three lines justified (indented left and right) and numbered in order to be able to refer to them in later contexts by citing that number. In addition, formulas and such textual blocks should share one and the same consecutive number sequence.
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to have textual sentences numbered as formulas?

Post by ks-zadeh »

Hello again:

I have tested it in the meantime. However, without \blindtext because for any reason my LaTeX does not cooperate with. But even without \blindtext the program functions, say 50%. Text set by myself is well justified (left and right) AND numbered. Alas, the number goes in the next paragrpah, whereas the numbering itself is integrated into that of formulas to the effect that its consecutivity is retained.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to have textual sentences numbered as formulas?

Post by frabjous »

Can you actually provide an example showing this error?

Do you get the problem even with this:

Code: Select all

\documentclass{article}
\usepackage{amsmath} % for \text command
\begin{document}
Here is your example. I've corrected it to be standard English. I'm putting this paragraph here mainly so you can see how it looks relative to the rest of the page.
\begin{equation}
\text{\parbox{.85\textwidth}{All AIDS patients are infected with HIV. Antony
Perkins has AIDS. But he is not infected with HIV. These
two sentences are inconsistent.}}
\end{equation}
Here is another paragraph that I put in just to show that the number is not going in the wrong place. Do you like my paragraph?
\end{document}
For me, that looks like this:
sample-image.png
sample-image.png (11.74 KiB) Viewed 11788 times
If this doesn't work for you, add \listfiles to the document, and post the log, and the output, here.

(Can I also point out that even with my grammatical fixes, those sentences are not logically inconsistent, since you have AIDS without being an AIDS patient? Or is that being too pedantic?)
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to have textual sentences numbered as formulas?

Post by ks-zadeh »

Yes, I also tested it. Now it is perfect and look like yours. I don't know why it went wrong in my first attempt. It works really with any text of arbitrary length. That is just what I wanted to have - because I am working with a Springer LaTeX for authors and cannot use any alien package. I would very much like to thank you for your valuable assistance. That was / is great!
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

How to have textual sentences numbered as formulas?

Post by ks-zadeh »

Sorry, I have discovered that I have overlooked your following comment above that you have made on my AIDS example recently:

"(Can I also point out that even with my grammatical fixes, those sentences are not logically inconsistent, since you have AIDS without being an AIDS patient? Or is that being too pedantic?)"

What I meant was people who have AIDS. Disregard the word "patient". So my example turns:

For all x: If x has AIDS, then x is infected with HIV;
Anthony Perkins has AIDS. But he is not infected with HIV. These
two sentences are inconsistent.

Proof: The premise "For all x: If x is P then x is Q; a is P; a is not Q" implies contradictions and thus it implies everything.

By the way: I have unsuccessfully tried to construct a handy \newenvironment on the basis of the program we have agreed upon recently. The textual output I obtain and the number allocated to it by the \begin{equation}-based newenvironment are misplaced.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to have textual sentences numbered as formulas?

Post by frabjous »

Could you show the definition that produces the bad placement?

My code isn't really well-suited for defining a new environment, since the text goes inside brackets, and you can't match the brackets in the environment definition. http://www.latex-community.org/forum/vi ... f=5&t=7757

The easiest thing to do would be to define a command rather than an environment. But there may be a way to do an environment with minipage, but I'm too busy right now to test.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newcommand{\texteq}[1]{\begin{equation}\text{\parbox{0.85\textwidth}{#1}}\end{equation}}

\begin{document}
Here is an example of a statement, and a bad proof of that statement. The reason the proof is bad is that ``inconsistent'' and ``implies contradictions'' mean the same thing, and hence, it is circular to presuppose the latter in trying to establish the former.
\texteq{For all $x$: If $x$ has AIDS, then $x$ is infected with HIV;
Anthony Perkins has AIDS. But he is not infected with HIV. These
two sentences are inconsistent.}
\begin{proof}
The premise ``For all $x$: If $x$ is $P$ then $x$ is $Q$; $a$ is $P$; $a$ is not $Q$'' implies contradictions and thus it implies everything.
\end{proof}
\end{document}
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to have textual sentences numbered as formulas?

Post by ks-zadeh »

That is phantastic! Thank you very much!! (My definition was obviously a very amateurish one, so I prefer to hide it.)

Your definition is elegant and functions well. Only referencing poduces the following error: Not the number of the textual item but the section number where it stands is displayed.

BTW: Inconsistency IS in fact defined as implying a contradiction because from a contradiction you can derive every sentence, be it true, false, non-sensical, etc. Use simply the rule "Ex contradictione quodlibet". That is: "A and not-A /- B" where "/-" stands for "implies" and B is any sentence you like.
Post Reply