
Estou escrevendo algumas notas contendo muitos capítulos e seções. Ao final de cada seção deste arquivo gostaria de inserir uma lista de exercícios com o seguinte título:
Problems - Section x.y (x = chapter, y = section)
\begin{exercise}
blah blah blah
\end{exercise}
Eu poderia fazer isso usando um comando \label como
\section{NameSection}\label{secx.y}
bla bla bla
Problems - Section \ref{secx.y}
\begin{exercise}
blah blah blah
\end{exercise}
Existe alguma maneira de usar algum comando como \lastchapter.section ou \current.chapther.section em vez de \ref{secx.y} ?
Estou usando hiperlinks para.
\documentclass[a4paper, 12pt]{report}
\usepackage{mathpazo, amsmath,amsfonts,amscd,bezier, amssymb, ifthen,amsthm}
\usepackage[x11names, usenames,svgnames,dvipsnames, table]{xcolor}
\RequirePackage[babel=true]{microtype}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tasks}
\usepackage{graphicx}
\usepackage{float}
\usepackage[margin=1.5cm ]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{indentfirst}
\usepackage{eqparbox, ulem}
\usepackage{lipsum}
\usepackage[colorlinks=true]{hyperref}
\hypersetup{allcolors=magenta}
\everymath{\displaystyle}
\newcounter{theeq}
\counterwithin{theeq}{chapter}
\setcounter{theeq}{0}
\newcommand{\eq}{
\
\noindent
\refstepcounter{theeq}\textbf{\thechapter.\arabic{theeq}}. }
%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{test1}
\lipsum[2]
\section{test1.1}\label{test1.1}
\lipsum[3]
\begin{center}
\Large{Problems - Section \ref{test1.1}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\section{test1.2}\label{test1.2}
\lipsum[3]
\begin{center}
\Large{Problems - Section \ref{test1.2}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\section{test1.3}\label{test1.3}
\lipsum[3]
\begin{center}
\Large{Problems - Section \ref{test1.3}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\chapter{test2}
\lipsum[3]
\section{test2.1}\label{test2.1}
\begin{center}
\Large{Problems - Section \ref{test2.1}}
\end{center}
\eq Let \(x \in R\)
\eq \(\lim_{x\to 0} \frac{1}{x}\)
\chapter{test3}
\section{test3.1}\label{test3.1}
\begin{center}
\Large{Problems - Section \ref{test3.1}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\end{document}
Responder1
Isso funcionará em uma execução. Você pode colocar quase tudo na entrada de texto.
Pode nem sempre funcionar para section.\thesection
, dependendo de como \thesection
está definido. Se você olhar no arquivo aux abaixo, \contentsline
encontrará o nome da âncora section.1.1
(por exemplo). É para isso que você precisa reproduzir \hyperlink
.
\documentclass[a4paper, 12pt]{report}
\usepackage{mathpazo, amsmath,amsfonts,amscd,bezier, amssymb, ifthen,amsthm}
\usepackage[x11names, usenames,svgnames,dvipsnames, table]{xcolor}
\RequirePackage[babel=true]{microtype}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tasks}
\usepackage{graphicx}
\usepackage{float}
\usepackage[margin=1.5cm ]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{indentfirst}
\usepackage{eqparbox, ulem}
\usepackage{lipsum}
\usepackage[colorlinks=true]{hyperref}
\hypersetup{allcolors=magenta}
\everymath{\displaystyle}
\newcounter{theeq}
\counterwithin{theeq}{chapter}
\setcounter{theeq}{0}
\newcommand{\eq}{
\
\noindent
\refstepcounter{theeq}\textbf{\thechapter.\arabic{theeq}}. }
%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{test1}
\lipsum[2]
\section{test1.1}\label{test1.1}
\lipsum[3]
\begin{center}
\Large{Problems - \hyperlink{section.\thesection}{Section \thesection}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\section{test1.2}
\lipsum[3]
\begin{center}
\Large{Problems - \hyperlink{section.\thesection}{Section \thesection}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\section{test1.3}
\lipsum[3]
\begin{center}
\Large{Problems - \hyperlink{section.\thesection}{Section \thesection}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\chapter{test2}
\lipsum[3]
\section{test2.1}
\begin{center}
\Large{Problems - \hyperlink{section.\thesection}{Section \thesection}}
\end{center}
\eq Let \(x \in R\)
\eq \(\lim_{x\to 0} \frac{1}{x}\)
\chapter{test3}
\section{test3.1}
\begin{center}
\Large{Problems - \hyperlink{section.\thesection}{Section \thesection}}
\end{center}
\eq Let \(x \in R\)
\eq xx
\end{document}