关于此代码
\documentclass{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{xcolor}
\usepackage{imakeidx}
\usepackage[tight, italian]{minitoc}
\usepackage{hyperref}
\setcounter{chapter}{-1}
\setcounter{section}{-1}
\newcommand*{\arabicdec}[1]{\the\numexpr\value{#1}-1\relax}
%\renewcommand*{\thechapter}{\arabicdec{chapter}}
\renewcommand*{\thesection}{\thechapter.\arabicdec{section}}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{4}
\begin{document}
\title{\color{red}{\Huge{\textbf{ALGEBRA LINEARE}}}}
\author{\color{blue}{\Huge{\textbf{???}}}}
\date{27 Febbraio 2021 $-$ xx Mese Anno}
\frontmatter
\maketitle
\dominitoc
\tableofcontents
\newpage
\section*{PREFAZIONE GENERALE}
\addcontentsline{toc}{section}{\protect\numberline{}PREFAZIONE GENERALE}
\mainmatter
\chapter{NOTAZIONI PRELIMINARI}
\minitoc %\minilof\minilot
\mtcskip
\pagestyle{plain}
\section{??}
\newpage
\part{\huge\color{red}{FONDAMENTI DELL'ALGEBRA LINEARE}}
\section*{Prefazione alla Prima Parte}
\addcontentsline{toc}{section}{Prefazione alla Prima Parte}
\Large{Inserire una Prefazione}
\chapter{One}
\minitoc %\minilof\minilot
\mtcskip
\section{One.One}
\subsection{One.One.One}
\subsubsection{One.One.One.One}
\end{document}
汇编成这张照片:
我想把这个部分框起来:
我希望点(...数字页)从框的右侧开始。可以吗?谢谢,并致以最诚挚的问候
答案1
这用于\tikzmark
定位框的角。通过添加来延迟点\hspace
,其中所需的距离也是使用\tikzmark
(然后删除)计算的。
\ifTOC
注意和的用法。每个名称只使用一次\mytikzmark
很重要。\tikzmark
\documentclass{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{xcolor}
\usepackage{imakeidx}
\usepackage[tight, italian]{minitoc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\usepackage{hyperref}
\newif{\ifTOC}
\newcommand{\mytikzmark}[1]{\ifTOC\tikzmark{#1}\fi}
\setcounter{chapter}{-1}
\setcounter{section}{-1}
\newcommand*{\arabicdec}[1]{\the\numexpr\value{#1}-1\relax}
%\renewcommand*{\thechapter}{\arabicdec{chapter}}
\renewcommand*{\thesection}{\thechapter.\arabicdec{section}}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{4}
\begin{document}
\title{\color{red}{\Huge{\textbf{ALGEBRA LINEARE}}}}
\author{\color{blue}{\Huge{\textbf{???}}}}
\date{27 Febbraio 2021 $-$ xx Mese Anno}
\frontmatter
\maketitle
\dominitoc
\TOCtrue
\tableofcontents
\TOCfalse
\newpage
\section*{PREFAZIONE GENERALE}
\addcontentsline{toc}{section}{\protect\numberline{}PREFAZIONE GENERALE}
\mainmatter
\chapter{NOTAZIONI PRELIMINARI}
\minitoc %\minilof\minilot
\mtcskip
\pagestyle{plain}
\section{??}
\newpage
\part[FONDAMENTI DELL'ALGEBRA LINEARE]%
{\huge\color{red}{FONDAMENTI DELL'ALGEBRA LINEARE}}
\section*{Prefazione alla Prima Parte}
\addcontentsline{toc}{section}{Prefazione alla Prima Parte}
\Large{Inserire una Prefazione}
\chapter{One}
\minitoc %\minilof\minilot
\mtcskip
\addtocontents{toc}{\string\mytikzmark{TOCboxA}}%
\section[One.One\string\hspace{116pt}]{One.One}
\subsection[One.One.One\string\hspace{64pt}]{One.One.One}
\subsubsection[One.One.One.One\string\mytikzmark{TOCboxB}]{One.One.One.One}
\addtocontents{toc}{\string\tikz[overlay,remember picture]% make sure on same apge
{\string\draw ($(pic cs:TOCboxA)+(-2pt,2pt-\the\dp\strutbox)$) rectangle
($(pic cs:TOCboxB)+(2pt,-2pt-\the\dp\strutbox)$);}}%
\end{document}