如何将图中的虚线替换为点划线?

发布于 2025-05-19 21:31:57

如图
image.png

如何将图中的虚线替换为点划线?
点划线参考 tikz 文档中的 dash dot
image.png

图中代码如下:

\documentclass{ctexart}
\usepackage{tabularray}
\begin{document}

\begin{table}[ht]
\centering
\caption{\textbf{????}}
\begin{tblr}{colspec = {c|c|[dashed]c|c}}
\hline
\textbf{???} & \SetCell[c=2]{c}\textbf{???} && \textbf{??}\\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}??? & ?? & ?? & \SetCell[r=3]{c}???\\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=6]{c}?? & ?? & ?? & \SetCell[r=6]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}?? & ?? & ?? & \SetCell[r=3]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
\end{tblr}
\end{table}

\end{document}

要求:

  1. 尽量使用 tabularray 宏包,也可以使用其他宏包实现(但不会采纳)。
  2. 必须在 overleaf (texlive 2024)上实现或下图 tabularray 版本的宏包,如不行提供 texlive 以及相关宏包的版本。

image.png

查看更多

关注者
0
被浏览
295
2 个回答
寄存器
寄存器 2025-05-20
这家伙很懒,什么也没写!

直接使用点画线样式可以吗?

colspec = {c|c|[dotted]c|c}

image.png

Sagittarius Rover
Sagittarius Rover 2025-05-20
我要成为Typst糕手/(ㄒoㄒ)/~~

记录昨晚失败的尝试...

本意是希望改写\NewTblrDashStyle命令的样式,以便自定义[dashdot]类似的样式来,也许是最佳实践....我把它续问在了这里

但是tabularray宏包在使用solid,dotted以及dashed这些样式时使用的是手动绘制rule的方式,这使得进行类似的拓展变得比较困难...

https://pastebin.com/BrecH5My

🤨🤨🤨...


Edit:另一种workaround

必须在 overleaf (texlive 2024)上实现或下图 tabularray 版本的宏包,如不行提供 texlive 以及相关宏包的版本。

我的版本信息为2025-A,提供了更好的tikz支持,如果需要在overleaf上使用,你也可以upload最新版的tabularray.sty

 *File List*
 ctexart.cls    2022/07/14 v2.5.10 Chinese adapter for class article (CTEX)
ctexbackend.cfg    2022/07/14 v2.5.10 Backend configuration file (CTEX)
   expl3.sty    2025-03-26 L3 programming layer (loader) 
l3backend-xetex.def    2025-03-14 L3 backend support: XeTeX
ctexhook.sty    2022/07/14 v2.5.10 Document and package hooks (CTEX)
ctexpatch.sty    2022/07/14 v2.5.10 Patching commands (CTEX)
  fix-cm.sty    2020/11/24 v1.1t fixes to LaTeX
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
ctexopts.cfg    2022/07/14 v2.5.10 Option configuration file (CTEX)
 article.cls    2024/06/29 v1.4n Standard LaTeX document class
  size10.clo    2024/06/29 v1.4n Standard LaTeX file (size option)
ctex-engine-xetex.def    2022/07/14 v2.5.10 XeLaTeX adapter (CTEX)
   xeCJK.sty    2022/08/05 v3.9.1 Typesetting CJK scripts with XeLaTeX
xtemplate.sty    2024-08-16 L3 Experimental prototype document functions
fontspec.sty    2024/05/11 v2.9e Font selection for XeLaTeX and LuaLaTeX
  xparse.sty    2024-08-16 L3 Experimental document command parser
fontspec-xetex.sty    2024/05/11 v2.9e Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty    2021/04/29 v2.0v Standard LaTeX package
fontspec.cfg
   xeCJK.cfg    2022/08/05 v3.9.1 Configuration file for xeCJK package
zhnumber.sty    2022/07/14 v3.0 Typesetting numbers with Chinese glyphs
zhnumber-utf8.cfg    2022/07/14 v3.0 Chinese numerals with UTF8 encoding
ctex-scheme-chinese-article.def    2022/07/14 v2.5.10 Chinese scheme for article (CTEX)
ctex-name-utf8.cfg    2022/07/14 v2.5.10 Caption with encoding UTF-8 (CTEX)
ctex-c5size.clo    2022/07/14 v2.5.10 c5size option (CTEX)
ctex-fontset-windows.def    2022/07/14 v2.5.10 Windows fonts definition (CTEX)
    ctex.cfg    2022/07/14 v2.5.10 Configuration file (CTEX)
tabularray.sty    2025-03-11 v2025A Typeset tabulars and arrays with LaTeX3
varwidth.sty    2009/03/30 ver 0.92;  Variable-width minipages
    tikz.sty    2023-01-15 v3.1.10 (3.1.10)
     pgf.sty    2023-01-15 v3.1.10 (3.1.10)
  pgfrcs.sty    2023-01-15 v3.1.10 (3.1.10)
pgfrcs.code.tex
 pgfcore.sty    2023-01-15 v3.1.10 (3.1.10)
graphicx.sty    2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2022/05/29 v1.15 key=value parser (DPC)
graphics.sty    2024/08/06 v1.4g Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2023/12/02 v1.11 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
   xetex.def    2022/09/22 v5.0n Graphics/color driver for xetex
  pgfsys.sty    2023-01-15 v3.1.10 (3.1.10)
pgfsys.code.tex
pgfsyssoftpath.code.tex    2023-01-15 v3.1.10 (3.1.10)
pgfsysprotocol.code.tex    2023-01-15 v3.1.10 (3.1.10)
  xcolor.sty    2024/09/29 v3.02 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
mathcolor.ltx
ninecolors.sty    2022-02-13 v2022D Select colors with proper color contrast
pgfcore.code.tex
pgfcomp-version-0-65.sty    2023-01-15 v3.1.10 (3.1.10)
pgfcomp-version-1-18.sty    2023-01-15 v3.1.10 (3.1.10)
  pgffor.sty    2023-01-15 v3.1.10 (3.1.10)
 pgfkeys.sty    
pgfkeys.code.tex
 pgfmath.sty    
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex

下面是MWE:

\documentclass{ctexart}
\usepackage{tabularray}
\UseTblrLibrary{tikz}
\begin{document}
\begin{table}[ht]
\centering
\caption{\textbf{????}}
\begin{tblrtikzabove}
    \draw[dash dot]
    (2-2.north east) -- (16-2.south east);
\end{tblrtikzabove}
\begin{tblr}{colspec = {c|cc|c}}
\hline
\textbf{???} & \SetCell[c=2]{c}\textbf{???} && \textbf{??}\\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}??? & ?? & ?? & \SetCell[r=3]{c}???\\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=6]{c}?? & ?? & ?? & \SetCell[r=6]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}?? & ?? & ?? & \SetCell[r=3]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
\end{tblr}
\end{table}

\end{document}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览