Math & Sciencehfill like command in the equation environment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
curiouslearn
Posts: 105
Joined: Fri Nov 30, 2007 11:32 pm

hfill like command in the equation environment

Post by curiouslearn »

Hi,

I was wondering if there is something that works like \hfill, in the display environment. I want to get a place a blacksquare at the end of the line on which a displayed equation is present to indicate end of the proof.
Please see the code below.

Code: Select all

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mdwlist}
\usepackage{natbib}
\usepackage{showkeys} %To see labels (of equations, proof and lemma numbers) when working on a draft.
\usepackage{paralist}% Package that allows different types of lists such as in paragraph lists.
\usepackage[margin=1in,left=1.2in]{geometry} 
\usepackage[T1]{fontenc}
\usepackage[charter]{mathdesign}                                 
\def\sm{\scriptscriptstyle}
\usepackage{tikz}

\newtheorem{proposition}{Proposition}

\setlength{\parindent}{0in}
\setlength{\parskip}{2ex plus 0.5ex minus 0.2ex}

\begin{document} 
	Objective: To get the blacksquare in the same line as the equation below, and at the end of the line. Write down it is one line below.  
  	\begin{equation*}
	\delta_{0} f_{\sm D}(EG_{\sm D}^{\sm 0B}) / F_{\sm D}(EG_{\sm D}^{\sm 0B}) >(<) \delta_{1} f_{\sm D}(EG_{\sm D}^{\sm 1B}) / F_{\sm D}(EG_{\sm D}^{\sm 1B}). 
	\end{equation*}\hspace*{\fill}{$\blacksquare$}
	
	
\end{document}                                         
Many thanks in advance.

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

hfill like command in the equation environment

Post by kaiserkarl13 »

The proof environment automatically puts a symbol at the end (in your case, \renewcommand{\qedsymbol}{$\blacksquare$} will do it). However, a known limitation is that it will NOT put it on the same line as the display.

One way around it:

Code: Select all

\begin{equation}
  \delta_{0} f_{\sm D}(EG_{\sm D}^{\sm 0B}) / F_{\sm D}(EG_{\sm D}^{\sm 0B}) >(<) \delta_{1} f_{\sm D}(EG_{\sm D}^{\sm 1B}) / F_{\sm D}(EG_{\sm D}^{\sm 1B}).
  \tag*{$\blacksquare$}
\end{equation}
This tricks the package into including an equation "number" that's actually the end of the proof symbol. This wouldn't work if your equation was numbered, but then you'd want it on the next line and the proof environment would work anyway.
curiouslearn
Posts: 105
Joined: Fri Nov 30, 2007 11:32 pm

Re: hfill like command in the equation environment

Post by curiouslearn »

Thanks very much kaiserkarl13. That worked great.
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: hfill like command in the equation environment

Post by daleif »

the ntheorem package has the ability to hook into math and automatically add the end of proof marker.

The \hfill trick have been used by many people, I still see lots of authors using it.
The main problem is that (1) it may actually not go to the left edge (that can be fixed, see what amsthm does internally), (2) you may have a page break before the marker, so in general it is a bad construction.

On the other hand using environments, gives the document a much better markup structure.
curiouslearn
Posts: 105
Joined: Fri Nov 30, 2007 11:32 pm

Re: hfill like command in the equation environment

Post by curiouslearn »

Thanks daleif. The problem in my case was that I was not using (by choice) the proof environment for typesetting the proof. Thanks for your tips though for future when I am using the proof environment.
Post Reply