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

注册于 3年前

回答
505
文章
0
关注者
20

基于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

补充一个测试记录:

以论文「Magnetic and mechanical hardening of nano-lamellar magnets using thermo-magnetic fields」为例

Step 1. 打开Nature官方链接:https://www.nature.com/articles/s41467-025-57571-6

Step 2. 找到「Cite this article」,点击下载「Download citation」将得到与你展示相同的一个「.ris」文件

image.png

『注意到上述示例的引用方式使用了「Article Number=2423」』

Step 3. 导入「Zotero」后使用原生的「bibtex」导出分类

image.png

这将得到如下的「refs.bib」文件:

@article{hanMagneticMechanicalHardening2025,
    title = {Magnetic and mechanical hardening of nano-lamellar magnets using thermo-magnetic fields},
    volume = {16},
    issn = {2041-1723},
    url = {https://doi.org/10.1038/s41467-025-57571-6},
    doi = {10.1038/s41467-025-57571-6},
    abstract = {High-performance magnetic materials based on rare-earth intermetallic compounds are critical for energy conversion technologies. However, the high cost and supply risks of rare-earth elements necessitate the development of affordable alternatives. Another challenge lies in the inherent brittleness of current magnets, which limits their applications for high dynamic mechanical loading conditions during service and complex shape design during manufacturing towards high efficiency and sustainability. Here, we propose a strategy to simultaneously enhance the magnetic and mechanical performance of a rare-earth-free multicomponent magnet. We achieve this by introducing nano-lamellar structures with high shape anisotropy into a cobalt–iron–nickel–aluminum material system through eutectoid decomposition under externally applied thermo-magnetic fields. Compared to the conventional thermally activated processing, the thermo-magnetic field accelerates phase decomposition kinetics, producing finer lamellae spacings and smaller eutectoid colonies. The well-tailored size, density, interface, and chemistry of the nano-lamellae enhance their pinning effect against the motion of both magnetic domain walls and dislocations, resulting in concurrent gains in coercivity and mechanical strength. Our work demonstrates a rational pathway to designing multifunctional rare-earth-free magnets for energy conversion devices such as high-speed motors and generators operating under harsh service conditions.},
    language = {en},
    number = {1},
    journal = {Nature Communications},
    author = {Han, Liuliu and Wang, Jin and Peter, Nicolas J. and Maccari, Fernando and Kovács, András and Schwaiger, Ruth and Gutfleisch, Oliver and Raabe, Dierk},
    month = mar,
    year = {2025},
    pages = {2423},
}

在zotero的策略下,默认将其保留为字段「pages」


Step 4 测试o( ̄▽ ̄)ブ 对于如下的MWEB:

\documentclass{article}
\usepackage{libertinus}
\usepackage[style=nature]{biblatex}
\begin{filecontents*}[overwrite]{refs.bib}

@article{hanMagneticMechanicalHardening2025,
    title = {Magnetic and mechanical hardening of nano-lamellar magnets using thermo-magnetic fields},
    volume = {16},
    issn = {2041-1723},
    url = {https://doi.org/10.1038/s41467-025-57571-6},
    doi = {10.1038/s41467-025-57571-6},
    abstract = {High-performance magnetic materials based on rare-earth intermetallic compounds are critical for energy conversion technologies. However, the high cost and supply risks of rare-earth elements necessitate the development of affordable alternatives. Another challenge lies in the inherent brittleness of current magnets, which limits their applications for high dynamic mechanical loading conditions during service and complex shape design during manufacturing towards high efficiency and sustainability. Here, we propose a strategy to simultaneously enhance the magnetic and mechanical performance of a rare-earth-free multicomponent magnet. We achieve this by introducing nano-lamellar structures with high shape anisotropy into a cobalt–iron–nickel–aluminum material system through eutectoid decomposition under externally applied thermo-magnetic fields. Compared to the conventional thermally activated processing, the thermo-magnetic field accelerates phase decomposition kinetics, producing finer lamellae spacings and smaller eutectoid colonies. The well-tailored size, density, interface, and chemistry of the nano-lamellae enhance their pinning effect against the motion of both magnetic domain walls and dislocations, resulting in concurrent gains in coercivity and mechanical strength. Our work demonstrates a rational pathway to designing multifunctional rare-earth-free magnets for energy conversion devices such as high-speed motors and generators operating under harsh service conditions.},
    language = {en},
    number = {1},
    journal = {Nature Communications},
    author = {Han, Liuliu and Wang, Jin and Peter, Nicolas J. and Maccari, Fernando and Kovács, András and Schwaiger, Ruth and Gutfleisch, Oliver and Raabe, Dierk},
    month = mar,
    year = {2025},
    pages = {2423},
}
\end{filecontents*}
\addbibresource{refs.bib}
\begin{document}

hello\cite{hanMagneticMechanicalHardening2025}, world!

\printbibliography  

\end{document}

将得到:

image.png

官网下效果对比(我不太确定官网是不是就是style=nature...可能还需要一些biblatex选项...)

image.png


另附「谷歌学术镜像」导出的refs.bib文件:

@article{han2025magnetic,
  title={Magnetic and mechanical hardening of nano-lamellar magnets using thermo-magnetic fields},
  author={Han, Liuliu and Wang, Jin and Peter, Nicolas J and Maccari, Fernando and Kov{\'a}cs, Andr{\'a}s and Schwaiger, Ruth and Gutfleisch, Oliver and Raabe, Dierk},
  journal={Nature Communications},
  volume={16},
  number={1},
  pages={2423},
  year={2025},
  publisher={Nature Publishing Group UK London}
}

也许找到稳定、靠谱的.bib源是一种智慧,也需要运气...


好像没有回答原始问题:

Article number (不是 pages) 在 BibTeX (bib) 参考文献应该如何表示?

「是否应该」应该是「参考文献的目录是否符合预期」的意思?
从上面例子来看,即使设置为「Pages」,对于「nature」样式,这个「article number」的表现是符合预期的。

注意到在 RIS 文件中 Article number 被放到了 SP 字段(如下),这个字段的含义大概是 start page。这应该也是错误的。

个人觉得不太应该怀疑 Nature 官网导出的.ris文件...根据wikipedia「https://en.wikipedia.org/wiki/RIS_(file_format)」的「RIS规范说明」,应该不算「错误」...我没进一步深入搜索了...

image.png

如果利用 doi2bib 工具,则会发现参考文献中没有 Article number 2423

那我感觉是doi2bib的锅... 你可能是想报告doi2bib工具的bug? 新建issues

这是来自于 2020-2021 年的问题,当时没有妥善解决

如果当时有记录的链接,应该添加到这个页面,毕竟信息更多总是更方便后续查找的

类似的问答👇

如何使用latex打出类似向右推出、向左推不出的箭头? - kuing的回答 - 知乎
https://www.zhihu.com/question/622677788/answer/3217032851

基于luadraw宏包:

Notes: 需要自行安装、使用lualatex编译...

\documentclass[border=4pt]{standalone}
\usepackage{luadraw}
\begin{document}
\begin{luadraw}{name=implicit_function}
    local g = graph:new{
        window={-1,3.5,-2,2},size={10,10}
    }
    g:Linecap("round");g:Linewidth(8)
    local F = function(x,y) return (x-2)^2+y^2-16/((x+2)^2) end
    g:Dimplicit(F,{grid={500,500},draw_options="thick"})
    g:Daxes(
        {0,4,3},{
            arrows="-stealth",
            labelpos={"top","right"},
            originpos={"none","none"}
        }
    )
    g:Show()
\end{luadraw}
\end{document} 

image.png

image.png

请给完整、可复制的代码。

代码不是看出来问题的,是复制,编译,多次测试debug之后才能解决的...

如果代码不可复制或不完整,别人测试就需要花费更多的时间...


\documentclass[tikz,border=5pt]{standalone}
\makeatletter
\def\tikz@plot@samples@recalc#1:#2\relax{%
  \pgfmathparse{#1}%
  \let\tikz@temp@start=\pgfmathresult%
  \pgfmathparse{#2}%
  \let\tikz@temp@end=\pgfmathresult%
  \pgfmathparse{\tikz@temp@start + (\tikz@temp@end - \tikz@temp@start) / (\tikz@plot@samples - 1)}
  \edef\tikz@plot@samplesat{\tikz@temp@start, \pgfmathresult, ..., \tikz@temp@end, \tikz@temp@end}
}
\makeatother
\begin{document}
\begin{tikzpicture}[very thin,domain=-1:{2*sqrt(2)}]
\draw[-stealth] (-1.5,0)--(3,0)node[scale=0.7,right]{$x$};
\draw[-stealth] (0,-3)--(0,3)node[scale=0.7,left]{$y$};
\node[label={[anchor=north east,yshift=-.1em]$o$}] {};
\draw plot[samples=300] (\x,{sqrt(16/(\x+2)^2-(\x-2)^2)});
\draw plot[samples=300] (\x, {-sqrt(16/(\x+2)^2-(\x-2)^2)});
\end{tikzpicture}
\end{document}

image.png

如果不是非要用「LaTeX」的话,最好的办法是使用类似「X-mind」的软件,有对应的模板。

image.png

同时可以导出为「.pdf」文件(这也是高清矢量图),这是最高效的办法。当然,如果你是要探索forest的功能上限,那这个问题也是很有意义的。

发布
问题