0

I would like to tag a citation with equations; more precisely I would like tag citations using the following code and I would like tag them as I tag proposition, theorem etc... I tried to use the command \begin{quote}\end{quote} and I tried also to implement into my code what done in this but unfortunately it does not work: so could someone help me, please?

\documentclass[10pt]{article}

\usepackage[paperheight=29.7cm,paperwidth=21cm,textwidth=17cm,textheight=25 cm]{geometry}
\usepackage{layout}
\usepackage{titlesec}
\usepackage[hang,flushmargin]{footmisc}
\usepackage{hyperref}
\usepackage{caption}
\usepackage{soulutf8}
\usepackage[T1]{fontenc}
\usepackage{fontsize}
\linespread{1.5}

\usepackage{amsfonts}
\usepackage{mathrsfs}
\usepackage{yfonts}

\usepackage{enumitem}
\usepackage{stix2}

\usepackage{amsmath}
\usepackage{amsthm}

\setcounter{footnote}{-1}
\setcounter{equation}{-1}

\newtheorem{lemma}[equation]{Lemma}

\newtheorem{proposition}[equation]{Proposizione}

\newtheorem{corollary}[equation]{Corollario}

\newtheorem{theorem}[equation]{Teorema}

\hypersetup{colorlinks,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black} %Personalizzazione aspetto collegamenti ipertestuali

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%I get the following code from [here](https://tex.stackexchange.com/a/614685/296807) to manipulate the fontsize of an equation.
\ExplSyntaxOn
\NewDocumentEnvironment{sequation}{O{\small}b}
 {
  \yufip_sequation:nnn {equation}{#1}{#2}
 }{}
\NewDocumentEnvironment{sequation*}{O{\small}b}
 {
  \yufip_sequation:nnn {equation*}{#1}{#2}
 }{}
\cs_new_protected:Nn \yufip_sequation:nnn
 {
  \begin{#1}
  \mbox{#2$\displaystyle#3$}
  \end{#1}
 }
\ExplSyntaxOff

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
% Here I wrote my document using some mathematical symbols as \cup, \cap, \bigcup, \bigcap, \setminus, \bot, \top, \rightthreetimes, \leftthreetimes, \odot, \oplus etc... and any any mathematical fonts as \mathcal, \mathfrak and \mathscr


\end{document}

To follow an example of what I would be make: I did it using word!

enter image description here

10
  • 2
    Can you clarify what you mean by "tag a citation with equations"? I don't understand at all what the expected output is supposed to be, nor what the expected input should look like. Jun 15, 2023 at 16:04
  • I want mean this: If this equation $\begin{equation}\end{equation}$ is tagged with number $n$ then putting the following quote into the code $\begin{quote}\end{quote}$ I would like it is tagged with numerb $n+1$: is now clear what I ask? Jun 15, 2023 at 16:08
  • 2
    It appears you want numbering of quotes. So that is clear-ish. But how would you like it to be formatted? Where should the number appear? If you just want it to look similar to Theorems, would something like \newtheorem{numquote}[equation]{} work for you? If not, why not? Jun 15, 2023 at 16:26
  • 1
    @AntonioMariaDiMauro \begin{equation} \text{this is a quote}\end{equation} does what you ask Jun 15, 2023 at 19:27
  • 1
    @AntonioMariaDiMauro note the image helped but you didn't fix your example which had no example text and mostly consisted of code unrelated to the question \usepackage{soulutf8},\usepackage{yfonts}, ... (do not load amsfonts and stix2 you can not use both sets at the same time) Jun 15, 2023 at 19:46

3 Answers 3

1

It's not very clear in what your “quote” should behave. I assume it should do the same as the standard quotation environment.

I also provide for \tag (not \tag*, which could be done if needed).

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} % for mock text

\newenvironment{tagquotation}{%
  \begin{equation}
  \global\tagquotationtagfalse
  \hspace{\leftmargin}%
  \hspace{-0.5em}%
  \begin{minipage}{\dimexpr\columnwidth-2\leftmargin\relax}%
  \setlength{\parindent}{1.5em}% like quotation
  \let\tag\tagquotationtag
}{%
  \end{minipage}\hspace{1000pt minus 1fill}
  \iftagquotationtag\tag{\thetagquotationtag}\fi
\end{equation}}
\newif\iftagquotationtag
\newcommand{\tagquotationtag}[1]{%
  \gdef\thetagquotationtag{#1}%
  \global\tagquotationtagtrue
}

\begin{document}

\ref{test}

\lipsum[1][1-4]
\begin{quotation}
\lipsum[2][1-4]
\end{quotation}
\lipsum[3][1-4]
\begin{tagquotation}\tag{x}\label{test}
\lipsum[4][1-4]
\end{tagquotation}
\lipsum[5][1-4]
\begin{equation}
1+1=2
\end{equation}
\lipsum[6][1-4]

\end{document}

enter image description here

Removing the \tag command, the output is

enter image description here

0
1

You can specify all constructs use the same counter:

enter image description here

\documentclass[fleqn]{article}

\setlength\mathindent{0pt}
\newtheorem{prop}[equation]{Proposition}
\newtheorem{thm}[equation]{Theorem}

\renewenvironment{quote}
{\begin{equation}\begin{minipage}{.8\textwidth}\raggedright}
{\end{minipage}\end{equation}\ignorespacesafterend}
\begin{document}

\begin{equation}
  eq=1
\end{equation}

\begin{quote}
  a quote
\end{quote}

\begin{prop}
  a prop
\end{prop}

\begin{thm}
  a theorem
\end{thm}

\begin{quote}
  another quote
\end{quote}
\end{document}
3
  • It seems your code works perfectly besides it seems it is not possibile enable (if it is necessary) the enumeration using the "star" (*) option: so I hazard to use "newenviroment" rather than "renewenviroment" and "myquote" rather than quote so that I a want tag a citation I use myquote environment whereas if I want not do it then I use simply (standard) quote environment. Do you think I did a good thing? Jun 15, 2023 at 20:58
  • Could I ask moreover if it is possible to center the minipage as the default quote command do automatically? Indeed, it seem to me that the code you wrote move excessively the text on the right. Forgive the bother. Jun 15, 2023 at 21:00
  • @AntonioMariaDiMauro you posted an image of a required layout with equations and quotes flush left. So that's what I did. remove fleqn to get centering Jun 15, 2023 at 21:27
1

I am still not clear on all the requirements; but the following should get you started.

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

\newenvironment{numquote}{\vskip\abovedisplayskip\refstepcounter{equation}\begin{minipage}{\dimexpr\textwidth - 5em\relax}}{\end{minipage}\hfill(\theequation)\vskip\belowdisplayskip}

\begin{document}
\begin{equation}
E = mc^2
\end{equation}

Here be some text

\begin{numquote}\label{quote1}
    \lipsum[1]
\end{numquote}

The quoted passage \eqref{quote1} is from lipsum.
\end{document}

enter image description here


Explanations:

The code creates a new numbered quote environment called numquote using the

\newenvironment{<NAME>}{pre-code}{post-code}

construction. Our goal is to wrap your quoted material in a minipage (so that the width of the quoted material is less than that of the full textwidth, so that we have some space left in order to insert the equation number). So in the pre-code we will put \begin{minipage}{<width>} and \end{minipage}

The width of the minipage is decided to be \textwidth - 5em; you can adjust it yourself.

To support the equation number, we \refstepcounter{equation} before the start of the minipage environment. This increments the equation counter and allows cross referencing to work.

To print the equation number, we just print it flush with the right margin as (\theequation). The vertical alignment is automatic as minipages are centered (vertically) on the line.

Beyond those basic components, there is also some amount of vertical spacing inserted before and after the quotes (to set it off from the unquoted text). Absent any other requests concerning spacing and margins, I just use the same vertical spacing as for displayed equations. You can replace the \abovedisplayskip and \belowdisplayskip by whatever you feel as an appropriate glue.


If you want the equation number to be top-aligned, you can edit the code slightly.

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

\newenvironment{numquote}{\vskip\abovedisplayskip\begin{minipage}[t]{\dimexpr\textwidth - 5em\relax}\refstepcounter{equation}\leavevmode}{\end{minipage}\hfill (\theequation)\vskip\belowdisplayskip}

\begin{document}
\begin{equation}
E = mc^2
\end{equation}

Here be some text

\begin{numquote}\label{quote1}%
    \lipsum[2]
\end{numquote}

The quoted passage \eqref{quote1} is from lipsum. 
\end{document}

Explanation/Caveats:

  1. Adding the [t] optional argument to minipage makes it align near the top.
  2. However, \label if used in vertical mode will create additional vertical spacing. A hack to combat this enforces leaving vertical mode. But then \label may generate an extra space character, so we put % after \label. (Or you can put the \label at the end of the quote.)
3
  • @WilliWong Hi, it seems your code is the best for typesetting but unfortunately I see that the tag is put below and not alongside: could I ask if it is possibile to put the tag alongside? Jun 16, 2023 at 7:40
  • If you mean align the tag to the top of the quote, see edit. Jun 16, 2023 at 16:56
  • 1
    You can do the same with egreg's answer: because he wrapped things in equation, which places the tag more smartly, you can just add [t] to {minipage} in his solution and you will get top-aligned tags. Jun 16, 2023 at 17:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .