5 关于node竖排文字的两个问题

发布于 2022-04-24 15:30:45

各位大佬,我现有下列代码:

\documentclass[tikz,border=5pt]{standalone}
\usepackage{ctex}
\usetikzlibrary{arrows.meta,calc,positioning}
\tikzstyle{every node}=[font=\small]
\tikzset{>={Stealth[scale=1.1]}}
\tikzset{NR/.style={rectangle,draw,minimum height=0.5cm,inner ysep
=2pt,inner xsep=5pt,text=black,align=justify}}
\begin{document}
\begin{tikzpicture}[node distance=1cm,cyan]
\node[NR,text width=5em](a){导数的概念及其意义};
\node[NR,below=of a,xshift=-0.7cm,text width=1em](a1){导数的概念};
\node[NR,below=of a,xshift=0.7cm,text width=1em](a2){基本初等函数的导数公式};
\path(a.south)--++(0,-0.5cm)coordinate(x);
\draw(a.south)--(x)-|(a1.north);
\draw(a.south)--(x)-|(a2.north);
\end{tikzpicture}
\end{document}

4c543f2f9bb2b6843dba58f216f0fdb.jpg

我的问题是:(1)竖排文字的行距如何缩小?(2)右下的框要实现下图的效果
f337d1d2ade11814bb89e231b259185.jpg
请大佬指教!

查看更多

关注者
0
被浏览
1.1k
雾月
雾月 2022-04-24
这家伙很懒,什么也没写!

使用 upLaTeX 或 pLaTeX-ng 编译,不能使用其它引擎
image.png

\documentclass[tikz,border=5pt,dvipdfmx]{standalone}
\usepackage{ctex}
\newcommand\nodebox[2][5\ccwd]{\hbox{\vbox{\parindent=0pt \linespread{1}\selectfont
  \setlength\hsize{#1}\tate #2}}}
\usetikzlibrary{arrows.meta,calc,positioning}
\tikzstyle{every node}=[font=\small]
\tikzset{>={Stealth[scale=1.1]}}
\tikzset{NR/.style={rectangle,draw,minimum height=0.5cm,inner ysep
=2pt,inner xsep=5pt,text=black,align=center,font=\linespread{1}\small}}
\begin{document}
\begin{tikzpicture}[node distance=1cm,cyan]
\node[NR,text width=5em](a){导数的概念及其意义};
\node[NR,below=of a,xshift=-0.7cm,align=left](a1){\tate 导数的概念};
\node[NR,below=of a,xshift=0.7cm,align=left](a2){\nodebox[6\ccwd]{基本初等函数的导数公式}};
\path(a.south)--++(0,-0.5cm)coordinate(x);
\draw(a.south)--(x)-|(a1.north);
\draw(a.south)--(x)-|(a2.north);
\end{tikzpicture}

\end{document}

upLaTeX 编译:

uplatex main.tex % 生成 dvi(main.dvi)
dvipdfmx main.dvi % 生成 pdf(main.pdf)

pLaTeX-ng 编译:

platex-ng main.tex % 生成 dvi(main.dvi)
dvipdfmx main.dvi % 生成 pdf(main.pdf),这一步必须使用 dvipdfmx,默认生成的 pdf 仍保留空白边距
2 个回答
LaTeXStudio
LaTeXStudio 2022-04-24
这家伙很懒,什么也没写!

这样的排版方式是竖排了,不是限制文本宽度变成了换行了而已。简单一点自己 shortstack 单独设置行间距。如果不多的情况,临时解决。

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览