2

I have this code:

\documentclass[11pt]{book}

%----------------------------------------------------------------------------------------
%   VARIOUS REQUIRED PACKAGES AND CONFIGURATIONS
%----------------------------------------------------------------------------------------

\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry} % Page margins
\usepackage{tikz} % Required for drawing custom shapes
\usetikzlibrary{patterns,calc,matrix,intersections,circuits.logic.US}
\usepackage{booktabs} % Required for nicer horizontal rules in tables
\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book
\usepackage{nicefrac} % For comparison
\usepackage{microtype} % for better kerning in narrow columns
\usepackage[bottom]{footmisc}   % Place a footnote in an environment in the bottom of the page

%----------------------------------------------------------------------------------------
%   FONTS
%----------------------------------------------------------------------------------------

\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{textcomp}
\usepackage{eurosans}

% Removes the header from odd empty pages at the end of chapters
\makeatletter

%----------------------------------------------------------------------------------------
%   THEOREM STYLES
%----------------------------------------------------------------------------------------

\usepackage{amsmath,amsfonts,amssymb,amsthm} % For math equations, theorems, symbols, etc

\newcommand{\intoo}[2]{\mathopen{]}#1\,;#2\mathclose{[}}
\newcommand{\ud}{\mathop{\mathrm{{}d}}\mathopen{}}
\newcommand{\intff}[2]{\mathopen{[}#1\,;#2\mathclose{]}}

% Boxed/framed environments
\newtheoremstyle{ocrenumbox}% % Theorem style name
{0pt}% Space above
{0pt}% Space below
{\normalfont}% % Body font
{}% Indent amount
{\small\bf\sffamily\color{ocre}}% % Theorem head font
{\;}% Punctuation after theorem head
{0.25em}% Space after theorem head
{\small\sffamily\color{ocre}\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1)
    \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black}---\nobreakspace#3.}} % Optional theorem note
\renewcommand{\qedsymbol}{$\blacksquare$}% Optional qed square

\makeatother

% Defines the theorem text style for each type of theorem to one of the three styles above
\newcounter{dummy} 
\numberwithin{dummy}{section}
\theoremstyle{ocrenumbox}
\newtheorem{definitionT}{Definizione}[section]

%----------------------------------------------------------------------------------------
%   DEFINITION OF COLORED BOX
%----------------------------------------------------------------------------------------

\RequirePackage[framemethod=default]{mdframed} % Required for creating the definition box

% 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}    

% Creates the environment ---> @iacopo suggestion <---
\newenvironment{definition}[1]{\begin{dBox}\begin{definitionT}\item[\hskip \labelsep] {\bfseries #1}}{\end{definitionT}\end{dBox}}   

\begin{document}
    \begin{definition}
        Nella teoria dei circuiti numerici, la logica sequenziale è un tipo di circuito logico dove l'uscita dipende non solo dal valore attuale dei suoi segnali di ingresso ma anche dalla sequenza degli ingressi passati: la cronologia degli ingressi stessi.
        \footnote{Vai, M. Michael (2000). VLSI Design. CRC Press. p. 147. ISBN 0849318769. \\ Cavanagh, Joseph (2006). Sequential Logic: Analysis and Synthesis. CRC Press. pp. ix. ISBN 0849375649 \\ Lipiansky, Ed (2012). Electrical, Electronics, and Digital Hardware Essentials for Scientists and Engineers. John Wiley and Sons. p. 8.39. ISBN 1118414543. \\ Dally, William J.; Harting, R. Curtis (2012). Digital Design: A Systems Approach. Cambridge University Press. p. 291. ISBN 0521199506.}
    \end{definition}
\end{document}

that produce this result:

My result

But I would like the \footnote not in the environment, but in the bottom of the page.

  • 2
    Can we ask for a complete but minimal code we can compile? – Masroor Aug 30 '17 at 9:15
  • 1
    We need a full code example, since as iacopo shows, footnotes work from within normal envs. Yours are probably set inside a box to create this look and \footnote cannot escape this (as it is a float). But we cannot be more precise without more specific code. If you only have one inside the env, you could get away with \footnotemark inside the env, and adding \footnotetext{text} outside the env. – daleif Aug 30 '17 at 9:32
3

Here is a solution you can use.


\documentclass[11pt]{book}

%----------------------------------------------------------------------------------------
%   VARIOUS REQUIRED PACKAGES AND CONFIGURATIONS
%----------------------------------------------------------------------------------------

\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry} % Page margins
\usepackage{tikz} % Required for drawing custom shapes
\usetikzlibrary{patterns,calc,matrix,intersections,circuits.logic.US}
\usepackage{booktabs} % Required for nicer horizontal rules in tables
\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book
\usepackage{nicefrac} % For comparison
\usepackage{microtype} % for better kerning in narrow columns
\usepackage[bottom]{footmisc}   % Place a footnote in an environment in the bottom of the page

%----------------------------------------------------------------------------------------
%   FONTS
%----------------------------------------------------------------------------------------

\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{textcomp}
\usepackage{eurosans}

% Removes the header from odd empty pages at the end of chapters
\makeatletter

%----------------------------------------------------------------------------------------
%   THEOREM STYLES
%----------------------------------------------------------------------------------------

\usepackage{amsmath,amsfonts,amssymb,amsthm} % For math equations, theorems, symbols, etc

\newcommand{\intoo}[2]{\mathopen{]}#1\,;#2\mathclose{[}}
\newcommand{\ud}{\mathop{\mathrm{{}d}}\mathopen{}}
\newcommand{\intff}[2]{\mathopen{[}#1\,;#2\mathclose{]}}

% Boxed/framed environments
\newtheoremstyle{ocrenumbox}% % Theorem style name
{0pt}% Space above
{0pt}% Space below
{\normalfont}% % Body font
{}% Indent amount
{\small\bf\sffamily\color{ocre}}% % Theorem head font
{\;}% Punctuation after theorem head
{0.25em}% Space after theorem head
{\small\sffamily\color{ocre}\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1)
    \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black}---\nobreakspace#3.}} % Optional theorem note
\renewcommand{\qedsymbol}{$\blacksquare$}% Optional qed square

\makeatother

% Defines the theorem text style for each type of theorem to one of the three styles above
\newcounter{dummy} 
\numberwithin{dummy}{section}
\theoremstyle{ocrenumbox}
\newtheorem{definitionT}{Definizione}[section]

%----------------------------------------------------------------------------------------
%   DEFINITION OF COLORED BOX
%----------------------------------------------------------------------------------------

\RequirePackage[framemethod=default]{mdframed} % Required for creating the definition box

% 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}    

\usepackage{footnote}
\usepackage{etoolbox}
\newtoggle{indefintion}
\togglefalse{indefintion}
\pretocmd{\footnote}{\iftoggle{indefintion}{\stepcounter{footnote}}{\relax}}{}{}

% Creates the environment ---> @iacopo suggestion <---
\newenvironment{definition}[1]{%
  \savenotes
  \begin{dBox}\begin{definitionT}
      \toggletrue{indefintion}
      \renewcommand{\thempfootnote}{\arabic{footnote}}
    \item[\hskip \labelsep]
      {\bfseries #1}}{\end{definitionT}\end{dBox}
  \togglefalse{indefintion}
  \spewnotes}

\begin{document}
\begin{definition}
  Nella teoria dei circuiti numerici, la logica sequenziale è un tipo
  di circuito logico dove l'uscita dipende non solo dal valore attuale
  dei suoi segnali di ingresso ma anche dalla sequenza degli ingressi
  passati: la cronologia degli ingressi stessi.  \footnote{Vai,
    M. Michael (2000). VLSI Design. CRC Press. p. 147. ISBN
    0849318769. \\ Cavanagh, Joseph (2006). Sequential Logic: Analysis
    and Synthesis. CRC Press. pp. ix. ISBN 0849375649 \\ Lipiansky, Ed
    (2012). Electrical, Electronics, and Digital Hardware Essentials
    for Scientists and Engineers. John Wiley and Sons. p. 8.39. ISBN
    1118414543. \\ Dally, William J.; Harting, R. Curtis
    (2012). Digital Design: A Systems Approach. Cambridge University
    Press. p. 291. ISBN 0521199506.}
\end{definition}

\bigskip

Let us add some text here and add a footnote to it\footnote{Yes, this
  footnote is to \textit{normal} text.}.  

\bigskip

And then we add another definition without any footnote.

\bigskip

\begin{definition}
  NO FOOTNOTE IS THIS ONE. The footnote counter must not misbehave.
  Nella teoria dei circuiti numerici, la logica sequenziale è un tipo
  di circuito logico dove l'uscita dipende non solo dal valore attuale
  dei suoi segnali di ingresso ma anche dalla sequenza degli ingressi
  passati: la cronologia degli ingressi stessi.
\end{definition}

\bigskip

And another definition with a footnote.

\bigskip

\begin{definition}
  A FOOTNOTE IS THIS ONE. The footnote counter must be updated properly.
  Nella teoria dei circuiti numerici, la logica sequenziale è un tipo
  di circuito logico dove l'uscita dipende non solo dal valore attuale
  dei suoi segnali di ingresso ma anche dalla sequenza degli ingressi
  passati: la cronologia degli ingressi stessi.  \footnote{TeXSE is a
    wonderful site.}
\end{definition}


\end{document}

enter image description here


How It Works?

There were a number of hurdles which I had to cross in order to solve this problem. I will describe them each and hopefully, that will also explain how exactly the solution is working:

  1. In order to display the footnote which is issued in mdframed (used in dBox creation) we need to actually defer the footnote creation until we are out of the dBox. We achieve this by using the \savenotes, \spewnotes command pair. We use \savenotes before \begin{dBox} which start saving up footnotes, and the \spewnotes command after \end{dBox} executes them all at the end, thus putting them in a normal page scenario.
  2. The above worked fine but we then note that the footnote counter needs to be manually incremented in the above case. This is achieved by issuing a simple \stepcounter{footnote} inside dBox.
  3. This generates another problem. The footnote counter gets incremented even when there is not any footnote in that particular dBox. And naively incrementing the footnote counter for every footnote would mean garbling up the normal text footnotes, where counters are handled automatically.
  4. In order to solve the above issue, we define a toggle switch indefintion which is set to false at the start (default, but set manually nonetheless). At the start of definition, it is set to true, and before we finish the definition, we set it back to false.
  5. To utilize the above toggle, we append the conditional check of testing if we are inside of a definition, at the start of \footnote command. We use the \pretocmd command from etoolbox for this.

We have tested the feature for three cases:

  • definition with a footnote,
  • definition without a footnote,
  • footnote in normal text.

All the tests were successful.

To learn more about the \savenotes, \spewnotes command pair, please see the documentation of footnote package. To learn more about the \pretocmd command, see the documentation of etoolbox (3.4 Patching), or this wonderful answer.

2

This is a solution, I just add this \usepackage[bottom]{footmisc} for your purpose:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[bottom]{footmisc}

\begin{document}
\newenvironment{definition}[1][Definizione]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\begin{definition}
Nella teoria dei circuiti numerici, la logica sequenziale è un tipo di circuito logico dove l' uscita dipende non solo dal valore attuale dei suoi segnali di ingresso ma anche dalla sequenza degli ingressi passati: la cronologia degli ingressi stessi.
\footnote{Vai, M. Michael (2000). VLSI Design. CRC Press. p. 147. ISBN 0849318769. \\ Cavanagh, Joseph (2006). Sequential Logic: Analysis and Synthesis. CRC Press. pp. ix. ISBN 0849375649 \\ Lipiansky, Ed (2012). Electrical, Electronics, and Digital Hardware Essentials for Scientists and Engineers. John Wiley and Sons. p. 8.39. ISBN 1118414543. \\ Dally, William J.; Harting, R. Curtis (2012). Digital Design: A Systems Approach. Cambridge University Press. p. 291. ISBN 0521199506.}
\end{definition}
\end{document}

Here is my result:

enter image description here

You should check Here.

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.