0

I'm using this The Legrand Orange Book Template (English)

And when I use align environment in a example one, I got this space between the equation and qed (the black square below):

enter image description here

I tried to use \vspace{-1em} after \end{align*} but it didn't change anything.

The code from the template:

 \newtheoremstyle{blacknumbox} % Theorem style name
    {0pt}% Space above
    {0pt}% Space below
    {\normalfont}% Body font
    {}% Indent amount
    {\small\bf\sffamily}% Theorem head font
    {\;}% Punctuation after theorem head
    {0.25em}% Space after theorem head
    {\small\sffamily\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1)
    \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}%

Optional theorem note

\theoremstyle{blacknumex}
\newtheorem{exampleT}{Exemplo}[chapter]

% Definition box
\newmdenv[skipabove=7pt,
skipbelow=7pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=0pt,
leftmargin=0cm,
rightmargin=0cm,
linewidth=4pt,
innerbottommargin=0pt]{dBox}

\newenvironment{example}{\begin{dBox}\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}\end{dBox}}
Sebastiano
  • 54,118
mvfs314
  • 543
  • 1
    How are you adding the qed? – egreg Jun 28 '18 at 15:45
  • Welcome to TeX.SX! We need to see your code as it's impossible to guess what is going wrong if we don't know what you are doing! Please do not post your full code but instead distill it down to a minimal working example. This should compile and be as small as possible to demonstrate your problem. –  Jun 28 '18 at 15:46
  • @egreg I'm using the template (the code is in the link). I didn't put it here because is too much. – mvfs314 Jun 28 '18 at 15:49
  • 1
    Do you terminate the second row of the equation with double-backslash? If so, try omitting the double-backslash. – Mico Jun 28 '18 at 16:16
  • @Mico no, I don't do it. – mvfs314 Jun 28 '18 at 16:20
  • 1
    your template link just goes to an image, but you should provide a full small document that uses that class that shows the problem, and use the {} button in the editor so the example is formatted as a code block, otherwise it is very hard to offer any help. – David Carlisle Jun 28 '18 at 16:23
  • I editted @DavidCarlisle see the code; – mvfs314 Jun 28 '18 at 16:31
  • @mvfs314 - Your code isn't showing any material (yet). – Mico Jun 28 '18 at 16:33
  • @DavidCarlisle I doubt a user asking a question here using this template would be able to provide a minimal working example. If the template is from latextemplates.com, latex.org would be the proper place to ask. But if any modifications would have been made to structure.tex, support would be close to impossible. One reason why i hate those big templates. – Johannes_B Jun 30 '18 at 06:18

1 Answers1

1

It is almost impossible to guess what your problem is without a Minimal Working Example. The preamble you provided was also incomplete: Where does \newmdenv come from?

Since you are using the align* environment and the \newtheoremstyle command, I guess you have loaded the amsmath and amsthm packages. If so, then a simple line of code—\qedhere—would solve your problem. I will use the proof environment as an illustration. For defining an example/remark environment that comes with a QED-like symbol, I suggest a simpler solution here.

So, instead of

\theoremstyle{blacknumex}
\newtheorem{exampleT}{Exemplo}[chapter]
...
\newenvironment{example}{\begin{dBox}\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}\end{dBox}}

I would suggest

\theoremstyle{blacknumex}
\newtheorem{exampleT}{Exemplo}[chapter]
...
\newenvironment{example}
  {\dBox\pushQED{\qed}\renewcommand{\qedsymbol}{\tiny\ensuremath{\blacksquare}}\exampleT}
  {\popQED\endexampleT\enddBox}

I cannot test the code above since I do not have the necessary information on \newmdenv and thus the dBox environment is undefined.

MWE

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\begin{document}
\begin{proof}
\begin{align*}
\frac{2+3i}{1-i} & = \frac{2+3i}{1-i} \cdot \frac{1+i}{1+i} \\
 & = \frac{2+2i+3i+3i^2}{1^2-i^2} = -\frac{1}{2} + \frac{5}{2}i \qedhere
\end{align*}
\end{proof}
\end{document}

Output

enter image description here

Ruixi Zhang
  • 9,553