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

注册于 3年前

回答
510
文章
0
关注者
21

希望在书签里能显示出subsubsection

默认情况下就能显示出subsubsection...请展示你「不能体现出subsubsection书签」的具体截图。

\documentclass[fontset=fandol]{ctexart}
\usepackage{hyperref}
\begin{document}
\section{单词}
\subsection{词汇}
\subsubsection{二级词汇}
\end{document}

image.png

并且把\words{...}中的单词放入书签显示,与subsectionsubsubsection同一层次.

我没有这个字体,字体问题显然与是不是在书签显示,是不是同一层次无关。

image.png

加上hyperref提供的\pdfbookmark命令即可。其中level的含义是自解释的。

\documentclass[fontset=fandol]{ctexart}
\usepackage{hyperref}
\usepackage{xcolor}
\newcommand{\words}[1]{\pdfbookmark[2]{#1}{word:#1}\noindent{\huge\textbf{\textcolor{red}{#1}}~~}} 
% \newcommand{\words}[1]{\pdfbookmark[2]{#1}{work:#1}\noindent{\huge\textbf{\textcolor{red}{\fontspec{Avenir}#1}}~~}} 
\begin{document}
\section{单词}
\subsection{词汇}
\subsubsection{二级词汇}
\words{chenchen}
\words{辰辰}
\words{你好}
\end{document}

image.png

另外,我不觉得单词应该与\subsection或者\subsubsectionlevel.

与原文的最大差异是12pt的字体相对于版面太大了,改用默认的10pt并微调\item[]的定义即可:

\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\Input[1]{\item[\,\algorithmicinput]\ #1}
\algnewcommand\algorithmicoutput{\noindent\textbf{Output:}}
\algnewcommand\Output[1]{\item[\,\algorithmicoutput]\ #1}

完整代码:

\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{algpseudocode}
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\Input[1]{\item[\,\algorithmicinput]\ #1}
\algnewcommand\algorithmicoutput{\noindent\textbf{Output:}}
\algnewcommand\Output[1]{\item[\,\algorithmicoutput]\ #1}
\pagestyle{empty}
\begin{document}
\lipsum[1]

\medskip
\noindent\begin{minipage}{.49\textwidth}%
    \begin{algorithm}[H]
        \centering
        \caption{SSM(S4)}
        \begin{algorithmic}[1]
            \Input{$x:(B,L,D)$}
            \Output{$y:(B,L,D)$}
            \State $A:(D,N) \leftarrow \text{Parameter}$ \par \Comment{$\text {Represents structured}\ \ N \times N\ \ \text{martix}$}
            \State $B:(D,N) \leftarrow \text{Parameter}$ 
            \State $C:(D,N) \leftarrow \text{Parameter}$
            \State $\Delta:(D) \leftarrow \tau_\Delta(\text{Parameter})$
            \State $\bar{A},\bar{B}:(D,N) \leftarrow \text{discretize}(\Delta,A,B)$
            \State $y \leftarrow \text{SSM}(\bar{A},\bar{B},C)(x)$ \par
            \Comment{Time-invariant: recurrence or convolution}
            \State \textbf{return} y
        \end{algorithmic}
    \end{algorithm}%
\end{minipage}\hfill%
\begin{minipage}{.49\textwidth}%
    \begin{algorithm}[H]%
        \centering
        \caption{SSM+Selection(S6)}
        \begin{algorithmic}[1]
            \Input{$x:(B,L,D)}$
            \Output{$y:(B,L,D)$}
            \State $A:(D,N) \leftarrow \text{Parameter}$ \par \Comment{$\text{Represents structured}\ \ N \times N\ \ \text{martix}$}
            \State $B:\textcolor{red!90!black}{(B,L,N)} \leftarrow \textcolor{red!90!black}{s_B(x)}$ 
            \State $C:\textcolor{red!90!black}{(B,L,N)} \leftarrow \textcolor{red!90!black}{s_C(x)}$
            \State $\Delta:\textcolor{red!90!black}{(B,L,D)} \leftarrow \tau_\Delta(\text{Parameter}+\textcolor{red!90!black}{s_\Delta(x)})$
            \State $\bar{A},\bar{B}:(B,L,D,N) \leftarrow \text{discretize}(\Delta,A,B)$
            \State $y \leftarrow \text{SSM}(\bar{A},\bar{B},C)(x)$ \par
            \Comment{\textcolor{red!90!black}{Time-varying}: recurrence (\textcolor{red!90!black}{scan}) only}
            \State \textbf{return} y
        \end{algorithmic}
    \end{algorithm}
\end{minipage}%
\medskip

\lipsum[2]
\end{document}

image.png

基于schemata宏包不做任何微调的话:

\documentclass[border=5pt]{standalone}
\usepackage[fontset=fandol]{ctex}
\usepackage{schemata}
\begin{document}
\schema
{
    \schemabox{1 一级标题}
}
{ 
    \schema
    {
        \schemabox{1.1 二级标题} 
    }
    {
        \schema
        {
            \schemabox{1.1.1 三级标题}
        }
        {
            \schemabox{1.1.1.1 四级标题}
            \schemabox{1.1.1.2 四级标题}
        }
        \schema
        {
            \schemabox{1.1.2 三级标题}
        }
        {
            \schemabox{1.1.2.1 四级标题}
            \schemabox{1.1.2.2 四级标题}
        }
    }
    \schema
    {
        \schemabox{1.2 二级标题} 
    }
    {
        \schema
        {
            \schemabox{1.1.1 三级标题}
        }
        {
            \schemabox{1.1.1.1 四级标题}
            \schemabox{1.1.1.2 四级标题}
        }
        \schema
        {
            \schemabox{1.1.2 三级标题}
        }
        {
            \schemabox{1.1.2.1 四级标题}\smallskip
            \schemabox{\parbox{8em}{\linespread{1.0}\selectfont 文字文字文字文字文字文字文字文字文字文字文字文字}}
        }
    }
}
\end{document}

image.png

Edit微调

修改\Schema[⟨type⟩]{⟨adjust⟩}{⟨size⟩}调整brace的位置:

\documentclass[border=5pt]{standalone}
\usepackage[fontset=fandol]{ctex}
\usepackage{schemata}
\begin{document}
\Schema{-2ex}{8ex}
{
    \schemabox{1 一级标题}
}
{ 
    \Schema{0ex}{4.5ex}
    {
        \schemabox{1.1 二级标题} 
    }
    {
        \schema
        {
            \schemabox{1.1.1 三级标题}
        }
        {
            \schemabox{1.1.1.1 四级标题}
            \schemabox{1.1.1.2 四级标题}
        }
        \schema
        {
            \schemabox{1.1.2 三级标题}
        }
        {
            \schemabox{1.1.2.1 四级标题}
            \schemabox{1.1.2.2 四级标题}
        }
    }
    \Schema{-1.5ex}{5.5ex}
    {
        \schemabox{1.2 二级标题} 
    }
    {
        \schema
        {
            \schemabox{1.1.1 三级标题}
        }
        {
            \schemabox{1.1.1.1 四级标题}
            \schemabox{1.1.1.2 四级标题}
        }
        \schema
        {
            \schemabox{1.1.2 三级标题}
        }
        {
            \schemabox{1.1.2.1 四级标题}\smallskip
            \schemabox{\parbox{8em}{\linespread{1.1}\selectfont 文字文字文字文字文字文字文字文字文字文字文字文字}}
        }
    }
}
\end{document}

image.png

(OS.其实我感觉这个语法也并不优雅...不如forest...难用,不够自动化...)

可以试试这个...手动计算一下...不过是不是「最佳实践」呢🤔

\documentclass[border=5pt]{standalone}
\usepackage[fontset=fandol]{ctex}
\usepackage[edges]{forest}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{forest}
    for tree={
        grow'=east,
        anchor=west,
        inner sep=0pt,
        outer sep=0pt,
        fit=band,
        align=left,
        if n=1{edge path'={(!ul.south west)-- (!u1.north west)}}{no edge},
        edge={decorate, decoration={brace,amplitude=1.5mm,raise=2mm}},
    },
    before drawing tree={
        for tree={
            if n children=0{}{
                y/.pgfmath={(y("!1")+max_y("!1")+y("!l")+min_y("!l"))/2}
            }
        }
    }
    [1 一级标题
        [1.1 二级标题
            [1.1.1 三级标题
                [1.1.1.1 四级标题]
                [1.1.1.2 四级标题]
                [1.1.1.3 四级标题]
            ]
            [1.1.2 三级标题
                [1.1.2.1 四级标题]
                [1.1.2.2 四级标题]
                [1.1.2.3 四级标题[\parbox{5em}{文字文字文字文字文字文字文字文字文字文字文字文字}]]
                [1.1.2.4 四级标题]
            ]
        ]
        [1.2 二级标题
            [1.2.1 三级标题
                [1.2.1.1 四级标题]
                [1.2.1.2 四级标题]
            ]
            [1.2.2 三级标题
                [1.2.2.1 四级标题]
                [\parbox{8em}{文字文字文字文字文字文字文字文字文字文字文字文字}]
            ]
        ]
    ]
\end{forest}

\end{document}

image.png

基于tabularray的一个自动化方案...

\documentclass{article}
\usepackage{fourier}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{functional}
\IgnoreSpacesOn
\prgNewFunction \makeHundredCells { } {
  \tlSet \lTmpaTl { } 
  \intStepOneInline {1} {100} {
    \intCaseF { ##1 } {
        { 2 } {  }
        { 3 } {  }
        { 5 } {  }
        { 7 } {  }
    } {
        \intCompareTF { \intMathMod{##1}{2}  } = { 0 } {
          \tlPutRight \lTmpaTl { \SetCell{bg=magenta!50} } 
        }{
            \intCompareTF { \intMathMod{##1}{3} } = { 0 } {
              \tlPutRight \lTmpaTl { \SetCell{bg=cyan!50} } 
            }
            {
                \intCompareTF { \intMathMod{##1}{5} } = { 0 } {
                  \tlPutRight \lTmpaTl { \SetCell{bg=violet!50} } 
                }
                {
                    \intCompareT { \intMathMod{##1}{7} } = { 0 } {
                      \tlPutRight \lTmpaTl { \SetCell{bg=orange!50} } 
                    }
                }
            }
        }
      }
     \intCompareTF { ##1 } = { 1 } {
        \tlPutRight \lTmpaTl { } 
      }{
        \tlPutRight \lTmpaTl { ##1 }
      }
    \intCompareTF { \intMathMod{##1}{10} } = { 0 } {
      \tlPutRight \lTmpaTl { \\ } 
    }{
      \tlPutRight \lTmpaTl { & }
    }
  }
  \prgReturn { \expValue \lTmpaTl }
}
\IgnoreSpacesOff

\begin{document}

\begin{tblr}[evaluate=\makeHundredCells]{
        colspec = {*{10}{X[c]}},
        hlines, vlines,
        rows = {m, ht=3em},
    }
    \makeHundredCells 
\end{tblr}

\end{document}

或者等价的,用逻辑划分更清晰的evaluate = \makeTableBodyprocess = \myTblrProcessor分别控制内容和样式

\documentclass{article}
\usepackage{fourier}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{functional}
\IgnoreSpacesOn
\tlNew \lBodyTl
\tlNew \lCellValueTl
\prgNewFunction \makeTableBody { } {
  \tlClear \lBodyTl
  \intStepOneInline {1} {100} {
    \tlPutRight \lBodyTl { ##1 }
    \intCompareTF { \intMathMod{##1}{10} } = { 0 } {
      \tlPutRight \lBodyTl { \\ }
    }{
      \tlPutRight \lBodyTl { & }
    }
  }
  \prgReturn { \expValue \lBodyTl }
}
\prgNewFunction \myTblrProcessor { } {
  \intStepOneInline {1} {\arabic{rowcount}} {
    \intStepOneInline {1} {\arabic{colcount}} {
      \tlSet \lCellValueTl { \cellGetText {##1} {####1} }
        \intCompareT { \lCellValueTl } = { 1 } {
          \cellSetText {##1} {####1} { }
        }
        \intCaseF { \lCellValueTl } {
            { 2 } { } { 3 } { } { 5 } { } { 7 } { }
        } {
            \intCompareTF { \intMathMod{\lCellValueTl}{2} } = { 0 } {
              \cellSetStyle {##1} {####1} { bg=magenta!50 }
            }{
              \intCompareTF { \intMathMod{\lCellValueTl}{3} } = { 0 } {
                \cellSetStyle {##1} {####1} { bg=cyan!50 }
              }{
                \intCompareTF { \intMathMod{\lCellValueTl}{5} } = { 0 } {
                  \cellSetStyle {##1} {####1} { bg=violet!50 }
                }{
                  \intCompareT { \intMathMod{\lCellValueTl}{7} } = { 0 } {
                    \cellSetStyle {##1} {####1} { bg=orange!50 }
                  }
                }
              }
            }
        }
    }
  }
}
\IgnoreSpacesOff

\begin{document}

\begin{tblr}[
    evaluate = \makeTableBody
]{
  colspec = {*{10}{X[c]}},
  hlines, vlines,
  rows = {m, ht=3em},
  process = \myTblrProcessor
}
  \makeTableBody
\end{tblr}

\end{document}

image.png

问题0:

直接编译你的代码会得到一长串的警告:

Missing character: There is no T ("54) in font nullfont!
Missing character: There is no h ("68) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no o ("6F) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no m ("6D) in font nullfont!
Missing character: There is no 1 ("31) in font nullfont!
Missing character: There is no . ("2E) in font nullfont!
Missing character: There is no 0 ("30) in font nullfont!
Missing character: There is no . ("2E) in font nullfont!
Missing character: There is no 1 ("31) in font nullfont!
Missing character: There is no . ("2E) in font nullfont!
Missing character: There is no ( ("28) in font nullfont!
Missing character: There is no S ("53) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no m ("6D) in font nullfont!
Missing character: There is no i ("69) in font nullfont!
Missing character: There is no d ("64) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no f ("66) in font nullfont!
Missing character: There is no i ("69) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no i ("69) in font nullfont!
Missing character: There is no t ("74) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no v ("76) in font nullfont!
Missing character: There is no a ("61) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no i ("69) in font nullfont!
Missing character: There is no s ("73) in font nullfont!
Missing character: There is no h ("68) in font nullfont!
Missing character: There is no i ("69) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no g ("67) in font nullfont!
Missing character: There is no t ("74) in font nullfont!
Missing character: There is no h ("68) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no o ("6F) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no m ("6D) in font nullfont!
Missing character: There is no f ("66) in font nullfont!
Missing character: There is no o ("6F) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no v ("76) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no c ("63) in font nullfont!
Missing character: There is no t ("74) in font nullfont!
Missing character: There is no o ("6F) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no b ("62) in font nullfont!
Missing character: There is no u ("75) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no d ("64) in font nullfont!
Missing character: There is no l ("6C) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no o ("6F) in font nullfont!
Missing character: There is no f ("66) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no a ("61) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no k ("6B) in font nullfont!
Missing character: There is no ( ("28) in font nullfont!
Missing character: There is no G ("47) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no n ("6E) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no r ("72) in font nullfont!
Missing character: There is no a ("61) in font nullfont!
Missing character: There is no l ("6C) in font nullfont!
Missing character: There is no C ("43) in font nullfont!
Missing character: There is no a ("61) in font nullfont!
Missing character: There is no s ("73) in font nullfont!
Missing character: There is no e ("65) in font nullfont!
Missing character: There is no ) ("29) in font nullfont!
Missing character: There is no ) ("29) in font nullfont!

这不是可忽视的警告!

出现问题的语句是要传给overlay unbroken中的\settowidth

\newcommand{\my@lemma@overlay@unbroken}[2]{
   %%============== First ==============%%
   \def\rad{7pt}%
   \settowidth{\thmtcbtextlen}{\hspace*{10pt}#1.\ \ifdefvoid{\tcbtitletext}{}{(\itshape\tcbtitletext)}} %<-

这个问题的一个等价的MWE如下:

\documentclass{article}
\usepackage[most]{tcolorbox}
\newlength{\mylength}
\newcommand\mycmd[1]{%
    \settowidth{\mylength}{abcdefg}
    \node at (frame.south west) {\the\mylength};
    \draw[ultra thick,magenta] 
        (frame.north west) 
        -- 
        ([xshift=\mylength]frame.north west)
        node[right,font=\ttfamily] {#1:\the\mylength}
    ;
}
\begin{document}
\begin{tcolorbox}[
        title=A Simple Box,enhanced,
        overlay={\mycmd{A Simple Box}}
    ]
    This is a simple tcolorbox.
\end{tcolorbox}

\newlength{\anotherlength}
\settowidth{\anotherlength}{abcdefg}
\texttt{\the\anotherlength}

\end{document}

这个MWE编译会得到如下警告:

Missing character: There is no a in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no f in font nullfont!
Missing character: There is no g in font nullfont!

且对宽度的测量是不准确的。

image.png


该问题又可以进一步简化为「在tikz环境内不能直接使用\settowidth」:

\documentclass[tikz,border=5pt]{standalone}
\newlength{\mylength}
\begin{document}
\begin{tikzpicture}
    \settowidth{\mylength}{abcde}
    % \settowidth{\mylength}{\pgfinterruptpicture abcde\endpgfinterruptpicture}
    \draw (0,0) -- (\mylength,0) node[above right] {\the\mylength};
\end{tikzpicture}

\end{document}

会出现警告:

Missing character: There is no a in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!

image.png

解决方法和解释在这里

不知道是不是:

我想要根据标题长度切换不同的装饰样式,目前无论长度如何都没法切换成功

的一个体现。

问题要一个一个问,同时尽可能详细描述。 且同时问多个问题会令人难以回答,也会导致问题严重缺少针对性。试想有人需要查询类似问题,看到这个页面十分难以知道解决问题的核心点在哪里,会大大削弱本提问站的意义。

从你上述的描述中:

我想要根据标题长度切换不同的装饰样式,目前无论长度如何都没法切换成功?

不能期望别人很快读完这100多行之后准确get到什么是「目前无论长度如何都没法切换成功」。请详细说明你是具体是用哪些代码,具体是如何切换的,又是如何体现的「不成功」。

我想要底部装饰采用blur shadow而非drop shadow, 目前报错

如果遇到报错,请贴出命令行的报错信息。我将你的代码中的:

drop shadow={opacity=0.3,shadow xshift=.3pt}

替换为你注释掉的

blur shadow={shadow blur steps=10,shadow xshift=-1pt, shadow yshift=-1pt,shadow blur radius=1.5pt,shadow opacity=35} %一旦改成这个就会报错

tcolorbox-v6.9.0下并没有报错。

我想要使得背景的渐变颜色更加柔和,也就是增加middle部分(猜的,但是应该也只能这样了),目前一旦盒子跨页,就会出现背景中间很白,怪怪的,出现了背景颜色断层,目前的背景颜色逻辑貌似是在盒子跨页后,上下部分各画各的,都把top colorbottom color来上一遍,颜色的过度太生硬了且出现了断层,与shade[top/middle/bottom color] 这种比起来还有点差距,希望能有个更好点的方案

问题描述中出现了"跨页",以及大量对颜色形态的描述。但你提供的代码中盒子并未跨页,也缺少图示说明背景颜色如何令人不满意。没有人有魔法水晶球知道你想表达什么。请用提供图片和能直接体现这个需求的例子,另开问题询问为佳。

问题冲突的根源在于\maketitle内的这一行

\renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false}
\pagenumbering{Alph}
\begin{titlepage}
...
\end{titlepage}
\restoregeometry
\thispagestyle{empty}}

至于模板设计时为何要在标题去掉pageanchor,有没有其他重要的考量....暂时没什么头绪...

image.png


应该可以直接patch掉...

\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
  author       = {Aristotle},
  title        = {De Anima},
  date         = 1907,
  editor       = {Hicks, Robert Drew},
  publisher    = cup,
  location     = {Cambridge},
  keywords     = {primary},
  langid       = {english},
  langidopts   = {variant=british},
  annotation   = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{elegantbook}

\title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template}
\author{Ethan Deng, Liam Huang, syvshc, sikouhjw \& Osbert Wang}
\institute{Elegant\LaTeX{} Program}
\date{Dec. 31, 2022}
\version{4.5}
\bioinfo{Bio}{Information}
\extrainfo{\textcolor{red}{\bfseries Caution: This template will no longer be maintained since January 1st, 2023.}}
\logo{example-image-duck.pdf}
\cover{example-image-duck.pdf}
\ExecuteBibliographyOptions{backref=true}% add backref support here
\addbibresource{refs.bib}% bib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\patchcmd{\maketitle}{\hypersetup{pageanchor=false}}{}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter

\maketitle%<-

\mainmatter

\lipsum[1-10]

\section{Bibliography}

This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both \lstinline{numeric}. Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending

In order to get the editors' auto-completion working, you need to add following code in your preamble:

\lipsum

\printbibliography[heading=bibintoc, title=\ebibname]

\end{document}

甚至不愿意给一个链接来说明是哪个美赛模板...提问要言之有物

群里已由@u128385 老师解决。

应该在这里补上相关信息...否则这个链接的提问毫无意义...

模板:The_MCM_Thesis_of_Team_12345678__1_.zip

image.png

image.png

应该掌握正确的提问姿势,提供最小工作示例

阅读:https://ask.latexstudio.net/ask/article/644.html


文档具体采用的是哪一种字号(10pt?)? 是否调用caption宏包? 对间距的行为都有影响,因此MWE总是重要的。

既然已经在本站提过30+个问题,我不认为你不知道应该提供MWE...

image.png

image.png

模仿\raggedbottom\flushbottom的方案:

\documentclass{article}
\usepackage[
  paperwidth=120mm,
  paperheight=80mm,
  margin=10mm,
  showframe
]{geometry}
\usepackage{lipsum}

\begin{document}

\makeatletter
\def\@texttop{\vskip \z@ \@plus 1fil}
\makeatother

\section{abc}

\lipsum[2-3]

\newpage
\section{def}

\lipsum[2][1-3]

\end{document}

image.png


忽然发现我有一点理解错...我以为你需要的是对所有文本没垂直居中的页面都居中... Anyway...

本着学习的心态,我咨询了 TSE 上circuitikz的大神 @cis

这里的目标是要实现「单端的」电位器元件Potentiometer,可以只使用其genericpotentiometershape 这一底层的 PGF 节点形状:

image.png

其他内容手动使用tikz的路径实现即可:

% https://ask.latexstudio.net/ask/question/17966.html
% https://tex.stackexchange.com/a/757977/322482
\documentclass[margin=5pt, multi=circuitikz]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[
    european,line width=1pt,line cap=round,
    circuitikz/bipoles/thickness=1,% default = 2
    % https://tex.stackexchange.com/a/758070/322482
    % circuitikz/resistors/width=0.7,% default 0.8 ---> R and pR
    circuitikz/bipoles/generic potentiometer/height 2=0.2,% default 0.3 --> only pR
    % circuitikz/bipoles/generic/width=0.7,% default 0.8 --> only R
    circuitikz/bipoles/generic/height=0.2,% default 0.3 --> only R
]
    % R and Potentiometer
    \draw (0,0) 
        to [rmeter, t=A, -*] (0,2) coordinate(A)
        to [R, l_=R, name=r] (3,2) -- (4,2)
        node[
            genericpotentiometershape, %<-
            anchor=west, label=below:R${}^\prime$,
        ] (pr) {};
    % Battery and Potentiometer tap
    \draw (0,0) 
        to[battery1] (3,0) 
        to[normal open switch, l_=S, n=S] (6,0) 
        |-(pr.wiper);
    % Voltmeter
    \coordinate (M)  at ($(r)!.5!(pr)$);
    \draw
    (A) -- ++(0,1) coordinate(B) 
    to[rmeter, t=V]  (B -| M) 
    -- (M) node[circ] {}; % node style circ <=> `-*'
\end{circuitikz}
\end{document}

image.png

发布
问题