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

注册于 5年前

回答
22
文章
0
关注者
1

如果要求精确获取最终排版后目录最后一个条目所在的页码,可以通过三轮编译,笨是笨了点,但是能达到目的。

  1. 常规生成lof文件,同时计算目录所有条目的数量,写入aux文件
  2. 通过\listoffigures命令加载lof文件中的\contentsline命令,对目录的每一项进行排版,当处理最后一个条目时,向aux文件延时写入条目所在的页码,这样写入的页码会是当前条目所在页需要被shipout时的准确页码
  3. 第2轮生成的aux为此轮编译提供准确的页码

如果图片数量不多,只修改\l@figure,每处理一个条目就覆盖一次页码,也是可以的。

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{showframe}
\usepackage{pgffor}

\newcommand{\figlistlastpage}{0}

\makeatletter

\newcounter{totalfigurecount}
\setcounter{totalfigurecount}{0}
\newcounter{curfigurecount}
\setcounter{curfigurecount}{0}

%第一轮计算条目总数
\let\oldaddcontentsline\addcontentsline
\renewcommand{\addcontentsline}[3]{%
    \oldaddcontentsline{#1}{#2}{#3}%
    \ifnum\pdfstrcmp{#1}{lof}=0
        \stepcounter{totalfigurecount}
    \fi
}
%第一轮写入条目总数
\AtEndDocument{
    \if@filesw
        \immediate\write\@auxout{\string\gdef\string\finalfigcount{\thetotalfigurecount}}%
    \fi
}
%第二轮延迟写入最后一个条目的排版页码
\let\oldcontentsline\contentsline
\renewcommand{\contentsline}[4]{%
    \oldcontentsline{#1}{#2}{#3}{#4}%
    \ifnum\pdfstrcmp{#1}{figure}=0
        \stepcounter{curfigurecount}
        \ifnum\value{curfigurecount}=\finalfigcount\relax
            \if@filesw
                \protected@write\@auxout{}{
                    \string\gdef\string\figlistlastpage{\thepage}%
                }
            \fi
        \fi
    \fi
}
%\let\old@l@figure\l@figure
%\renewcommand{\l@figure}[2]{%
%    \old@l@figure{#1}{#2}%
%    % 每处理一个条目就会覆盖写入一次,最后留下的就是最后一页的页码
%    \protected@write\@auxout{}{%
%        \string\gdef\string\figlistlastpage{\thepage}%
%    }
%}
\makeatother

\begin{document}

% ----- 这部分是为了模拟 图目录之前还有其他内容填充 的情形 ----- %
\lipsum[1-4]

This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text. This is Text.
% =================================================== %

\listoffigures
\figlistlastpage

\foreach \n in {1, 2, ..., 24} { 
\begin{figure}[ht]
\centering
\includegraphics[width=.48\linewidth]{example-image-a}
\caption{This is text}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=.48\linewidth]{example-image-a}
\caption{This is text}
\end{figure}
\clearpage
}

%
%\begin{figure}[ht]
%\centering
%\includegraphics[width=.48\linewidth]{example-image-a}
%\caption{This is text}
%\end{figure}
\end{document}

局部截取_20251226_214120.png

楼主好像经常要给小朋友画平几草图,提几个拙见以供参考。

  1. 首要原则:怎么简单怎么来,不要只局限于题目的已知条件,对画草图这个目的,结论也是你的已知条件。比如灰原老师@u70550 给的答案就是一个很好的例证,结论+包提供的几个命令,很轻松就能画出来了。
  2. 结合自己的喜好和画图思维,熟练掌握包中的相关命令。有的命令偏向解析的方式(坐标),有的命令偏向几何方式(尺规),虽然命令背后的逻辑都是坐标运算,但是画图的时候要顺着自己的习惯去思考,这样才能事半功倍。

    比如你提到的:

    第(2)问里面我找了过(1,0)和(1,2)的线段与AB相交得到C点,然后旋转,算是取巧,但总算是顺利画出来了。

    这里显然是几何的痕迹多一点,我觉得就挺好的,只要自己思维顺畅就没问题。这题的数值比较简单,坐标很容易就能计算出来,但是万一下次碰到的数值比较奇怪,自己算就比较麻烦了,能简则简,能通用则通用。

  3. 当一种思维进行不下去的时候,可以结合几何知识,看能不能推出某些结论或者别的等量关系,从而简化坐标的计算。

    比如第(3)问中,如果不利用结论,只从题面入手也是可行的:
    1). 等腰直角三角形OCD,∠OBD=45°,D在第四象限 => 点C一定是△OBD的外心
    2). C在OB的中垂线上,OM⊥OB => 点C是MB的中点
    3). ∠OMC = 45°+22.5° = ∠DBC,CM=CB=CO=CD => △OMC≌△DBC,OM = BD
    4). 角平分线定理 => OM/AM = 1/sqrt(2) => OM = 4(sqrt(2)-1)

    有了2),就能定义出相关点

    \tkzDefLine[bisector](O,B,A) \tkzGetPoint{b}
    \tkzInterLL(B,b)(A,O) \tkzGetPoint{M}
    \tkzDefMidPoint(M,B) \tkzGetPoint{C}
    \tkzDefPointBy[rotation= center C angle 90](O) \tkzGetPoint{D}

    如果计算比较强,也可以不用\tkzDefLine[bisector],直接根据3)4)定义点

    \tkzDefPoint(0,4*sqrt(2)-4){M}
    \tkzDefShiftPoint[B](-135:{4*sqrt(2)-4}){D}
    \tkzDefMidPoint(M,B) \tkzGetPoint{C}

    完整代码

    \documentclass{article}
    
    \usepackage{tkz-euclide}
    
    \begin{document}
    
    \begin{tikzpicture}
    \tkzInit[xmin=-1,xmax=5,ymin=-2,ymax=5]
    \tkzDrawX[thick]
    \tkzDrawY[thick]
    \tkzDefPoint(0,0){O}
    \tkzDefPoint(4,0){B}
    \tkzDefPoint(0,4){A}
    
    % \tkzDefLine[bisector](O,B,A) \tkzGetPoint{b}
    % \tkzInterLL(B,b)(A,O) \tkzGetPoint{M}
    % 利用 2) 定义C
    % \tkzDefMidPoint(M,B) \tkzGetPoint{C}
    % 利用旋转得到 D
    % \tkzDefPointBy[rotation= center C angle 90](O) \tkzGetPoint{D}
    
    % 利用 3) 4) 直接定义 M,D,C
    \tkzDefPoint(0,4*sqrt(2)-4){M}
    \tkzDefShiftPoint[B](-135:{4*sqrt(2)-4}){D}
    \tkzDefMidPoint(M,B) \tkzGetPoint{C}
    
    \tkzDrawSegments[semithick](A,O O,B B,A M,B C,O C,D B,D O,D)
    
    \tkzLabelPoints[below left](O)
    \tkzLabelPoints[left](A,M)
    \tkzLabelPoints[below](D,B)
    \tkzLabelPoints[above](C)
    \end{tikzpicture}
    
    \end{document}
  4. 强化圆的知识,围绕圆可以推导出许多实用的性质,及时发现外接圆等隐藏的圆,做到图中无圆,心中有圆,一定可以避免掉很多主动计算,从而加快画图速度。
  5. 结合高中三角函数,解三角形等知识,硬算,这里就不展开了。对于初中几何草图来说,非必要也不推荐使用。
  6. 草图毕竟只是草图,有些苛刻的条件,实在无法精确画出,自己估算一下比例,多试几个点,做到“形似”也是可以接受的。
  7. 利用外部工具 Geogebra,Desmos,几何画板等,无论描点也好,导出图片也好,转成 tikz 代码也好,都是以备不需的手段。

局部截取_20251003_180946.png

\documentclass{ctexart}
\usepackage{tikz}

\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
    
    % ===== 定义点 =====
    \tkzDefPoint(0,0){O}
    \tkzDefPoint(-6.122,0){B}
    \tkzDefPoint(6.122,0){C}
    \tkzInterCC[R](O,6.122)(B,5.25) \tkzGetSecondPoint{A}
    \tkzInterCC[R](O,6.122)(C,7) \tkzGetFirstPoint{F}
    \tkzDefPointBy[rotation = center F angle -90](C) \tkzGetPoint{E}
    \tkzInterLL(B,F)(A,C) \tkzGetPoint{D}
    
    % ===== 绘制图形 =====
    % \tkzDrawPoints(A,B,C,D,E,F,O)
    \tkzDrawSegments[thick](A,B B,C C,A B,D C,E)
    % \tkzDrawCircle(O,B)
    % ===== 标记 =====
    % \tkzLabelPoints[below](O)
    \tkzLabelPoints[above](D)    
    \tkzLabelPoints[left](B)    
    \tkzLabelPoints[right](C)    
    \tkzLabelPoints[above left](A,E)  
    \tkzMarkRightAngle(B,A,C)  
    
\end{tikzpicture}
\end{document}

局部截取_20251003_181507.png

看了下源码,向右生长的时候,子树和父节点拼接时的基线是父节点的左端和子树的左端,所以它们各自左端的水平偏移是固定的level distance(与示例图相符);向下生长时,子树的上端和父节点的上端之间是固定的level distance;向左,向上也是类似的。

如果要使示例中蓝色部分为固定宽度(即父节点的右端和子树的左端相距固定宽度),拼接的时候需要将父节点的宽度也计算进去,可以重新定义\pgfsubtree,在拼接前加上额外的偏移量即可。

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{etoolbox}
\usepackage{scrlayer}
\DeclareNewLayer
  [ topmargin, contents = \layercontentsmeasure,addheight=\dimexpr\headheight+\headsep\relax,
  ] {measurelayer}
\DeclareNewPageStyleByLayers{measurestyle}{measurelayer}
\pagestyle{measurestyle}

\makeatletter
\def\pgfsubtree#1#2{%
\let\parentnodename\nodename
\pgftree@savechildx=\pgftree@childx
\pgftree@savechildy=\pgftree@childy
\pgftree@savechildi=\pgftree@childi
% Build subpicture with all the children and their subtrees
{\pgftree@childx=0pt%
\pgftree@childy=0pt%
\pgftree@childi=0%
\process@children #2}%
\begin{pgfsubpicture}%
% Create node
#1%
\ifnum\pgftree@childi>0%
% Place children
{% center so that parent is midway between origins of first and last children
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 添加额外的偏移
\ifdefstring\leveldirection{right}{\pgftransformshift{\pgfpointdiff{\pgfpoint{\the\pgf@picminx}{0}}{\pgfpoint{\the\pgf@picmaxx}{0}}}}{\message{no right patch}}
\ifdefstring\leveldirection{left}{\pgftransformshift{\pgfpointdiff{\pgfpoint{\the\pgf@picmaxx}{0}}{\pgfpoint{\the\pgf@picminx}{0}}}}{\message{no left patch}}
\ifdefstring\leveldirection{down}{\pgftransformshift{\pgfpointdiff{\pgfpoint{0}{\the\pgf@picmaxy}}{\pgfpoint{0}{\the\pgf@picminy}}}}{\message{no down patch}}
\ifdefstring\leveldirection{up}{\pgftransformshift{\pgfpointdiff{\pgfpoint{0}{\the\pgf@picminy}}{\pgfpoint{0}{\the\pgf@picmaxy}}}}{\message{no up patch}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\pgftransformshift{\pgfpointscale{-0.5}{\pgfqpoint{\the\pgftree@childx}{\the\pgftree@childy}}}%
\pgfplacesubpicture}%
% Draw the edges
{\pgftree@childi=0%
\process@edges #2}%
\fi
\end{pgfsubpicture}%
\global\pgftree@childi=\pgftree@savechildi
\global\pgftree@childx=\pgftree@savechildx
\global\pgftree@childy=\pgftree@savechildy
}
\makeatother

\begin{document}
\begin{tikzpicture}[
    grow=right,
    level distance=1cm,
    sibling distance=10pt,
    edge from parent/.style={
      draw,
      edge from parent path={
        (\tikzparentnode.east) %-- +(0pt, 0pt)
        |- (\tikzchildnode.west)
      },
    },
    every tree node/.style={anchor=west, inner sep=0pt, outer sep=0pt, draw},
  ]
  \Tree
    [.Root Node
      [.AAA-1 ]
      [.AAA-2 ]
      [.AAA-BBB-X 
          [.y-1 ]
          [.y-2 ]
      ]
      [.AAA-3 
        [.BBB-3 ]
        [.BBB-4 ]
      ]
    ]
\end{tikzpicture}
\hspace{5em}
\begin{tikzpicture}[
    grow=left,
    level distance=1cm,
    sibling distance=10pt,
    edge from parent/.style={
      draw,
      edge from parent path={
        (\tikzparentnode.west) %-- +(0pt, 0pt)
        |- (\tikzchildnode.east)
      },
    },
    every tree node/.style={anchor=east, inner sep=0pt, outer sep=0pt, draw},
  ]
  \Tree
    [.Root Node
      [.AAA-1 ]
      [.AAA-2 ]
      [.AAA-BBB-X 
          [.y-1 ]
          [.y-2 ]
      ]
      [.AAA-3 
        [.BBB-3 ]
        [.BBB-4 ]
      ]
    ]
\end{tikzpicture}
\par
\begin{tikzpicture}[
    grow=down,
    level distance=1cm,
    sibling distance=10pt,
    edge from parent/.style={
      draw,
%      edge from parent path={
%        (\tikzparentnode.east) %-- +(0pt, 0pt)
%        |- (\tikzchildnode.west)
%      },
    },
    every tree node/.style={anchor=north, inner sep=0.5cm, outer sep=0pt, draw},
  ]
  \Tree
    [.Root Node
      [.AAA-1 ]
      [.AAA-2 ]
      [.AAA-BBB-X 
          [.y-1 ]
          [.y-2 ]
      ]
      [.AAA-3 
        [.BBB-3 ]
        [.BBB-4 ]
      ]
    ]
\end{tikzpicture}
\par
\begin{tikzpicture}[
    grow=up,
    level distance=1cm,
    sibling distance=10pt,
    edge from parent/.style={
      draw,
%      edge from parent path={
%        (\tikzparentnode.east) %-- +(0pt, 0pt)
%        |- (\tikzchildnode.west)
%      },
    },
    every tree node/.style={anchor=south, inner sep=0.5cm, outer sep=0pt, draw},
  ]
  \Tree
    [.Root Node
      [.AAA-1 ]
      [.AAA-2 ]
      [.AAA-BBB-X 
          [.y-1 ]
          [.y-2 ]
      ]
      [.AAA-3 
        [.BBB-3 ]
        [.BBB-4 ]
      ]
    ]
\end{tikzpicture}
\end{document}

局部截取_20250913_005317.png

inline math换行的话,可以用 \allowbreak 替换 \\ 试试。

\begin{tblr}{
    colspec={*{3}{X[c,m]}},
    row{1} = {font=\bfseries},
    hlines,vlines,
    cell{even}{1} = {r=2}{m},
    cell{2-Z}{2-3} = {mode=math},
}
条件 & 方程 & 说明 \\
圆心在原点 & x^2+y^2=r^2 & a=b=0 \\
& x^2+y^2+F=0 & D=E=0 \\ 
圆过原点 & (x-a)^2+(y-b)^2=a^2+b^2 & a^2+b^2=r^2 \\ 
 & x^2+y^2+Dx+Ey=0 & F=0 \\
圆心在x轴上 & (x-a)^2+y^2=r^2 & b=0 \\
& x^2+y^2+Dx+F=0 & E=0 \\
圆与x,y轴都相切 & (x-a)^2+(y-b)^2=a^2 \allowbreak (|a|=|b|\neq 0) & |a|=|b|=r \\
& {x^2+y^2+Dx+Ey+F=0\allowbreak(|D|=|E|\neq 0)} & D^2=E^2=4F \\
\end{tblr}

局部截取_20250906_174746.png

猜测是 wrapstuff 在处理环绕正文匹配 group 的时候遇到了不匹配的问题,具体需要分析源码,可以直接向作者github提issue,但貌似好久没更新了~

如果你把enumeratewrapstuff两个环境间的题干去掉,就没有这个错了,说明后面跟单一的完整环境是可以被正确处理的,而单一的完整段落显然是可以被正确处理的,那干脆显式地在题干后强制添加\par或者强制添加一个空行来满足现有的处理逻辑,从结果来看似乎猜测还是有点靠谱的~

纯属拙见,仅供参考~

\documentclass{ctexart}
\usepackage{wrapstuff}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{wrapstuff}
\newcommand*{\mytxt}{我能吞下玻璃而不伤身体。}
\newcommand*{\mytxtt}{\mytxt\mytxt\mytxt\mytxt\mytxt\mytxt\mytxt\mytxt}

\begin{document}

\mytxtt
 \begin{wrapstuff}[r,top=2]
 \includegraphics[width=5.5cm,height=4.5cm]{example-image}
 \end{wrapstuff}
 2.(2024南宁模拟) \mytxtt(\qquad)\par
 %2.(2024南宁模拟) \mytxtt(\qquad)
 %
 \begin{enumerate}[label={\Alph*.}]%
 \item \mytxt
 \item \mytxt
 \item \mytxt
 \item \mytxt
 \end{enumerate}
\mytxtt  
\wrapstuffclear
\par\mytxtt
\par\mytxtt

\end{document}

局部截取_20250824_214107.png

coffins其实不难的,如果你对l3coffins编程式的书写风格感到不适,可以试试xcoffins--这就是一个把l3coffins封装好的,对用户使用相对友好的包。
回到这个问题上来,使用coffins来解决的思路大概如下:

  1. 把整个页面划分成3个部分,左边装饰+右边背景(红色虚线)+目录,对应三个coffins,这里假设左右比例为1:4

    \NewCoffin\LeftCoffin
    \NewCoffin\RightCoffin
    \NewCoffin\TocCoffin
    
    \SetVerticalCoffin \LeftCoffin {0.2\linewidth}{\color{red!20!white}\rule{\linewidth}{8cm}}
    \SetVerticalCoffin \RightCoffin {0.8\linewidth}{\color{blue!20!white}\rule{\linewidth}{8cm}}
  2. 在每个section开始的时候计数并设置label

    \newcounter{totalsection}
    \regtotcounter{totalsection}
    
    \AddToHook{cmd/section/before}{\refstepcounter{totalsection}}
    \AtBeginSection[]{\label{sec:\thesection}}
  3. 目录中section的标题可以通过 2. 中设置的label来获取,这样的好处就是可以通过现有的工具(如enumitem,tikz等)灵活地给目录设置样式,而beamer自带的defbeamertemplate操作比较复杂,扩展性也一般。

    \newsavebox{\myenum}
    \newlength{\enumwidth}
    
    \begin{lrbox}{\myenum}
        \begin{varwidth}{20em}
            \begin{enumerate}[label={\arabic*.\,},left=0pt]
                \foreach \i in {1,...,\number\totvalue{totalsection}} {
                    \item \hyperlink{sec:\i}{\nameref{sec:\i}}
                }
            \end{enumerate}
        \end{varwidth}
    \end{lrbox}
    \settowidth{\enumwidth}{\usebox{\myenum}}
    
    \SetVerticalCoffin \LeftCoffin {0.2\linewidth}{\color{red!20!white}\rule{\linewidth}{8cm}}
    \SetVerticalCoffin \RightCoffin {0.8\linewidth}{\color{blue!20!white}\rule{\linewidth}{8cm}}
    \SetVerticalCoffin \TocCoffin {\enumwidth}{\color{red}\fbox{\usebox{\myenum}}}
  4. 设置好这些盒子后,就可以通过盒子自带的锚点(需要的时候也可以自定义锚点),按照特定的布局进行拼接

        \SetHorizontalCoffin \OutputCoffin{}
        \JoinCoffins \RightCoffin[hc,vc]\TocCoffin[hc,vc]
        \JoinCoffins \OutputCoffin[l,vc]\LeftCoffin[l,vc]
        \JoinCoffins \OutputCoffin[r,vc]\RightCoffin[l,vc]
        \TypesetCoffin \OutputCoffin

完整代码如下

\documentclass[aspectratio=169]{beamer}
%%------------------------------------
%%------------------------------------
\usepackage{pgffor}
\usepackage{totcount}
\usepackage{xcoffins}
\usepackage{varwidth}
\usepackage{enumitem}

\NewCoffin\LeftCoffin
\NewCoffin\RightCoffin
\NewCoffin\TocCoffin
\NewCoffin\OutputCoffin

\newcounter{totalsection}
\regtotcounter{totalsection}

\AddToHook{cmd/section/before}{\refstepcounter{totalsection}}
\AtBeginSection[]{\label{sec:\thesection}}

\newsavebox{\myenum}
\newlength{\enumwidth}

\newcommand{\makecoffins}{
    \begin{lrbox}{\myenum}
        \begin{varwidth}{20em}
            \begin{enumerate}[label={\arabic*.\,},left=0pt]
                \foreach \i in {1,...,\number\totvalue{totalsection}} {
                    \item \hyperlink{sec:\i}{\nameref{sec:\i}}
                }
            \end{enumerate}
        \end{varwidth}
    \end{lrbox}
    \settowidth{\enumwidth}{\usebox{\myenum}}
    
    \SetVerticalCoffin \LeftCoffin {0.2\linewidth}{\color{red!20!white}\rule{\linewidth}{8cm}}
    \SetVerticalCoffin \RightCoffin {0.8\linewidth}{\color{blue!20!white}\rule{\linewidth}{8cm}}
    \SetVerticalCoffin \TocCoffin {\enumwidth}{\color{red}\fbox{\usebox{\myenum}}}

    \SetHorizontalCoffin \OutputCoffin{}
    \JoinCoffins \RightCoffin[hc,vc]\TocCoffin[hc,vc]
    \JoinCoffins \OutputCoffin[l,vc]\LeftCoffin[l,vc]
    \JoinCoffins \OutputCoffin[r,vc]\RightCoffin[l,vc]
    \TypesetCoffin \OutputCoffin
}

\begin{document}

\frame{
    \makecoffins
    %\tableofcontents
}

%\section{section one}
\section{section section section section section section section section section section one}
\frame{\frametitle{section one}some text}

\section{section two}
\frame{\frametitle{section two}some text}

\end{document}

局部截取_20250824_154944.png

局部截取_20250824_155319.png

@u10189 好奇这题答案是什么,$\frac{12}{10-3\sqrt{3}}$?奇奇怪怪的结果就有点慌。。。

实际上这是因为\newtheorem{problem}{Problem}定义的环境使用了默认的plain样式,自带上下各\topsep高度的空白间隙。
局部截取_20250822_002254.png
局部截取_20250822_001238.png
可以自定义样式来修改这一设置。

\newlength{\mytopsep}
\setlength{\mytopsep}{\topsep}
\divide\mytopsep by 2
\newtheoremstyle{mystyle}
    {\mytopsep}{\mytopsep}%
    {\itshape}{}
    {\bfseries}{.}
    { }{}
\theoremstyle{mystyle}
\newtheorem{problem}{Problem}

局部截取_20250822_002905.png

如果所有点都是有规律的,可以考虑把node-->node换成coordinate-->node的连接模式,从而来规避掉初始阶段a11节点没有定义的情况,保持代码形式的简洁。

  \begin{tikzpicture}[
    every label/.style={circle, inner sep=0pt, anchor=center}
  ]
    \foreach \i [
        evaluate=\i as \angle using {360/12*(\i-1/2)}
    ] in {0,...,11} {
        \node[fill, circle, inner sep=1pt, label={
            [minimum width=2.5em,label distance=.2cm]{\angle-60}:{\footnotesize $a_{\i}$}
        }] (a\i) at (\angle:2) {};
        % 动态计算上一个点的坐标(\angle-30:2)
        \draw[latex-] (a\i) -- (\angle-30:2);
    }
  \end{tikzpicture}

第一个问题:
在已知角B,且BD水平的情况下,点E就是以A为原点,角B为倾角,BD为半径的极坐标

\tkzDefShiftPoint[A](60:4.2){E}

第二个问题:
BD长度未知,但B,D,A三点均已定义(否则就无从谈起了)

  1. 角B已知,且BD水平

    • 计算出BD的长度,再用极坐标定义点
    \tkzCalcLength(B,D) \tkzGetLength{rBD}
    \tkzDefShiftPoint[A](60:\rBD){E}
    • 定义辅助点,再旋转
    \tkzDefPointWith[colinear=at A,K=1](B,D) \tkzGetPoint{x}
    \tkzDefPointBy[rotation=center A angle 60](x) \tkzGetPoint{E}
  2. 角B未知,运用尺规作图的原理,作圆找交点
\tkzDefPointWith[colinear=at A,K=1](B,D) \tkzGetPoint{x}
\tkzInterLC[near](B,A)(A,x) \tkzGetSecondPoint{E}

注:这里作圆只给出了最简单的一种方法,也可以通过半径来作圆。另外,直线和圆有两个交点的时候,需要注意先后顺序,一般会用到nearcommon等参数,具体请参考文档。

画平几草图方法肯定不止一种,宏包也不可能穷尽所有情况,关键还是要熟练掌握一些常用的重要命令,结合平几知识,组合运用,举一反三。

\documentclass{standalone}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}
    
  % Define the coordinates
  \coordinate (O1) at (0, {-5*sqrt(2)});
  \coordinate (O2) at (0, 0);
  
  % Define the square vertices
  \coordinate (A) at (0, {5*sqrt(2)});
  \coordinate (B) at ({5*sqrt(2)}, 0);
  \coordinate (C) at (0, {-5*sqrt(2)});
  \coordinate (D) at ({-5*sqrt(2)}, 0);
  
  % Define point P
  \coordinate (P) at ({(5/4)*sqrt(14)}, {(5/4)*sqrt(2)});
  
  % ++++++++++++++++++++++++++++++++++++++++++++++
  \begin{scope}[even odd rule]
    \clip (P) rectangle +(-10, 5);
    \clip (O1) circle[radius=10] (O2) circle[radius=5];
    \fill[green!70] (O1) circle[radius=10] (O2) circle[radius=5];
  \end{scope}
  % ++++++++++++++++++++++++++++++++++++++++++++++

  % Draw the axes
  \draw[->] (-9, 0) -- (9, 0) node[right] {$x$};
  \draw[->] (0, -9) -- (0, 9) node[above] {$y$};
  
  % Clip to the region above the x-axis for the first circle
  \begin{scope}
      \clip (-12, 0) rectangle (12, 15);
      
      % Draw the circle C: x^2 + (y + 5*sqrt(2))^2 = 100, only above x-axis
      \draw (O1) circle[radius=10];
  \end{scope}

  % Draw the circle x^2 + y^2 = 25
  \draw (O2) circle[radius=5];
  
  % Draw the square
  \draw (A) -- (B) -- (C) -- (D) -- cycle;
  
  % Draw and label point P
  \fill (P) circle (2pt);
  \node[above right] at (P) {$P\left(\frac{5}{4}\sqrt{14}, \frac{5}{4}\sqrt{2}\right)$};
  
  % Label the circles
  \node at (0, {5*sqrt(2) - 5}) {$x^2 + (y + 5\sqrt{2})^2 = 100$};
  \node at (0,-5.5) {$x^2 + y^2 = 25$};
  
\end{tikzpicture}

\end{document}

bef92a577c7f5b1b1145dd18fb593e0d.png

\documentclass[a4paper,12pt]{ctexart}
\usepackage{geometry}
\geometry{left=3cm,right=3cm,top=2.5cm,bottom=2.5cm}
\usepackage{amsmath}
\usepackage{calc}

\newcommand{\score}[1]{\textbf{#1分}}
\newcommand{\myitem}[1]{
  \setlength{\itemindent}{\widthof{\textbf{\stepcounter{enumi}\chinese{enumi}、(#1分)}}}% 
  \addtolength{\itemindent}{\labelsep}%
  \addtocounter{enumi}{-1} 
  \item[\textbf{\stepcounter{enumi}\chinese{enumi}、(#1分)}]
}

\begin{document}
\section{第一题}

\begin{enumerate}
    \myitem{10} 证明 Rolle 定理:如果函数 $f(x)$ 在闭区间 $[a, b]$ 上连续,在开区间 $(a, b)$ 上可导,并且 $f(a) = f(b)$,那么存在至少一个$c\in  (a, b)$,使得 $f'(c) = 0$。        
    \myitem{1} 证明 Rolle 定理:如果函数 $f(x)$ 在闭区间 $[a, b]$ 上连续,在开区间 $(a, b)$ 上可导,并且 $f(a) = f(b)$,那么存在至少一个$c\in  (a, b)$,使得 $f'(c) = 0$。
    \myitem{10000000000} 证明 Rolle 定理:如果函数 $f(x)$ 在闭区间 $[a, b]$ 上连续,在开区间 $(a, b)$ 上可导,并且 $f(a) = f(b)$,那么存在至少一个$c\in  (a, b)$,使得 $f'(c) = 0$。
\end{enumerate}

\end{document}

a5474ce3c0666a5ae4d14e43dae85bc2.png

这是 titlesectitletoc 共同作用的结果。

  • 首先,在 LegrandOrangeBook.cls 中加载 titlesec 包的时候使用了 newparttoc 选项,这使得可以通过 titletoc 包的相关命令来控制目录条目的输出。

28e42bbd5a1132b61d52b2e48240a6ba.png

eb5adceeea9351e5505f5f221f7b85ae.png

  • 其次,重新定义了\part命令,用来输出 part 页面。(这里并没有区分有序号和无序号的页面设置)

5f4e4033593fef40f9768b2669b7e354.png

ed71f652441da06b5b3eaf5e2daaf280.png

  • 最后,通过 titletoc 包中的 titlecontents 命令来控制 part 相关目录条目的输出,其中无序号条目由自定义命令 tocentrypartunnumbered 控制

f1f7b957a0722a144a543373ace0105b.png

bfb9dd5b9f97057fdd55c17dcd2e0dc1.png

d27fb2b8430322bbe8a84426372b1095.png

可以做一个简单的验证,修改 tocentrypartunnumbered
d14976a1714e614dc825d01ae6133132.png

dfdece40cde1e4a21577a60c45703762.png

可以用 setspace 包,给需要的单元格添加控制行距的命令cmd=\setstretch{1}来实现

\documentclass{article}
\usepackage{tabularray}
\usepackage{setspace}
\usepackage{ctex}

\begin{document}
\begin{tblr}{colspec = {ll}, hlines, stretch = {-1}, column{1} = {2\ccwd}, column{2} = {4\ccwd,cmd=\setstretch{1}}}
    \SetCell[r = 2]{l, h}\textbf{巻一} & 〇〇〇〇  \\
                                       & 〇〇〇〇〇\\
    \SetCell[r = 2]{l, h}\textbf{巻二} & 〇〇〇〇〇\\
                                       & 〇〇〇〇〇\\
    \textbf{巻三}                      & 〇〇〇〇〇\\
\end{tblr}

\vspace{1\baselineskip}
\begin{tblr}{colspec = {ll}, hlines, stretch = {1}, column{1} = {2\ccwd}, column{2} = {4\ccwd}}
    \SetCell[r = 2]{l, h}\textbf{巻一} & 〇〇〇〇  \\
                                       & 〇〇〇〇〇\\
    \SetCell[r = 2]{l, h}\textbf{巻二} & 〇〇〇〇〇\\
                                       & 〇〇〇〇〇\\
    \textbf{巻三}                      & 〇〇〇〇〇\\
\end{tblr}
\end{document}

3f1e95ab92d8bff0a14fda3608c8af92.png

发布
问题