LaTeXer
LaTeXer
这家伙很懒,什么也没写!

注册于 5年前

回答
503
文章
348
关注者
251

可能是版本原因导致的,建议更新下,命令行管理员执行:

tlmgr update --self --all --reinstall-forcibly-removed

提取码不对,网站附件 有大小限制,最好精简一个最小代码比较好。

解决方案一:选自:https://tex.stackexchange.com/questions/16336/add-an-asterisk-in-front-of-section-label-in-toc

\documentclass{book}
\usepackage{tocloft}
\usepackage{lipsum} % for dummy text
\newenvironment{hard}
{\renewcommand{\thesection}{*\thechapter.\arabic{section}}}
{}
% set section numbers in TOC flush right (from the tocloft documentation)
\newlength{\extralen}
\setlength{\extralen}{0.5em}    % need some extra space at end of number
\renewcommand{\cftsecpresnum}{\hfill} % note the double ‘l’ 
\renewcommand{\cftsecaftersnum}{\hspace*{\extralen}}
\addtolength{\cftsecnumwidth}{\extralen}
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{A regular section}\label{easylabel}
In Section~\ref{easylabel} we see\ldots
\lipsum
\begin{hard}
\section{A hard section}\label{hardlabel}
\lipsum
\end{hard}
In Section~\ref{hardlabel} we see\ldots
\end{document}

效果图:
image.png

解决方案二:莲枝提供:

\usepackage[titles]{tocloft}
\usepackage{etoolbox}

\section{Foo}
\addtocontents{toc}{\protecting{\renewcommand{\cftsubsecpresnum}{\makebox[0pt][r]{$\star$\space}}}}
\subsection{Something something}
\addtocontents{toc}{\protecting{\renewcommand{\cftsubsecpresnum}{}}}

效果图:
image.png

整体的格式基本差不多了,上下间距在设置字体大小的时候都考虑了。没必要去各种调试。

下面这个例子,来自 LaTeX 入门:

\vspace{\baselineskip}% 被忽略的高度
\[
\text{实数} \begin{cases}
\text{有理数}\smash[t]{\begin{cases}
\text{整数}\smash{\begin{cases}
\text{奇数} \\ \text{偶数}
\end{cases}}\\
\text{分数}
\end{cases}} \\[4ex]
\text{无理数}\smash[b]{\begin{cases}
\text{代数无理数} \\ \text{超越数}
\end{cases}}
\end{cases}
\]

样子如下:
image.png

实际就是一个命令如下,如果你是 texlive 默认自带了,命令行执行如下:

latexdiff  old.tex  new.tex  >output.tex

如果命令行或者终端不在tex文件目录则需要添加完整文件path。其中old.tex是修改之前的文件;new.tex是完善之后的文件;

这里输入引用文本符合千万不能忘记 output则为输出差异化tex文件。里面Texlive编译这个输出文件就可以一目了然看到变化了!

图片使用 tikz 绘图,可以直接 cite 或者 ref 的。独立文档之外的图片 肯定不行了。

代码太乱了,看不明白,最好给个完整还原样例。

推荐改改版吧,换用 ctexbook 作为基础类来做,就没这个问题了。

发布
问题