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}
Zarko
  • 296,517

1 Answers1

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}
Arun Debray
  • 7,126
  • 2
  • 30
  • 54