0

I have to be at the end of each example, sign the box. However, in various situations, it appears in some other places. I would like that it was always in the same place. I wish that was on the right side in the last line. As in the first example. I do not want to was lower as in the example of the second and third. When the example ends the text is well. However, when the ends using array or equation is below. I do not know how to change it. It is very important to me.

enter image description here It is my code:

\documentclass[12pt,a4paper,twoside]{book}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm, amssymb}
\usepackage[polish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{latexsym}
\usepackage[nottoc]{tocbibind}
\usepackage{graphicx}
\usepackage{fancyhdr}   
\usepackage{indentfirst}  
\usepackage{dsfont}
\usepackage{stackrel}
\usepackage{etoolbox}
\usepackage{listingsutf8}
\usepackage{ucs}
\usepackage{url}

\textwidth 15.3cm 
\textheight 22.2cm 
\topmargin 0cm 
\oddsidemargin 0.55cm 
\evensidemargin 0cm 

\fancypagestyle{number}{
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}


\newtheoremstyle{stylexample}% name
  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\normalfont}% Body font e.g. \normalfont \bfseries \itshape
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {}%        Punctuation after thm head
  {\newline}% Space after thm head: \newline = linebreak
  {}%         Thm head spec


\theoremstyle{stylzad}
\newtheorem{example}[chapter]{Example}
\AtEndEnvironment{example}{\null\hfill\qedsymbol}

\begin{document}
\thispagestyle{number}\chapter{Number}

\begin{example}
During the 19th century, mathematicians began to develop many different abstractions which share certain properties of numbers and may be seen as extending the concept. Among the first were the hypercomplex numbers, which consist of various extensions or modifications of the complex number system. Today, number systems are considered important special examples of much more general categories such as rings and fields, and the application of the term "number" is a matter of convention, without fundamental significance.
\end{example}

\begin{example}
$$
\begin{array}{c}
abc:\\
a  \\
b \\
c .\\
\end{array}$$\end{example}

\begin{example}
\begin{equation} \nonumber
2+3=5
\end{equation}
\end{example}

\end{document}
  • 3
    You should use \qedhere. – Matsmath Jun 2 '16 at 15:45
  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). By the way, you can have a look there to know more about minimal working example (MWE) (-; – ebosi Jun 2 '16 at 15:47
  • 1
    Using ntheorem instead of amsthm, this would be automatic. Comment aside; don't use $$…$$, which plain TeX code for displayed equations. Replace it with \[ … \]. – Bernard Jun 2 '16 at 16:03
  • 1
    That is how it is when you use amsthm, you could switch to ntheorem, and use its thmmarks option, then it can place it like you want. There is a price to pay of course, no blank lines before end example, plus it may take a few compilations before the marker settles – daleif Jun 2 '16 at 16:04
  • I add \qedhere but i don't see box – user107084 Jun 2 '16 at 16:07
0

The way to fix this is to use \qedhere at the end of the last line of math, before you close any environment such as array or align.

\begin{example}
\[
\begin{array}{c}
abc:\\
a   \\
b   \\
c. \qedhere % <-- here
\end{array}
\]
\end{example}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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