该问题的mwe可以更短
emotion或者emoji宏包只是使用lualatex编译的理由
% lualatex
\documentclass{ctexart}
\begin{document}
你好
\end{document}可能有关:
该问题的mwe可以更短
emotion或者emoji宏包只是使用lualatex编译的理由
% lualatex
\documentclass{ctexart}
\begin{document}
你好
\end{document}可能有关:
感觉是varwidth的基线和stretch的功能互相作用导致...
如果想要「每一行的高度至少有“3行那么高”,当然不一定必须是3行,也可以是3cm,5cm等」,似乎用ht会更方便(?)
\documentclass[border=2pt]{standalone}
\usepackage{ctex,tabularray,xcolor,varwidth}
\begin{document}
\begin{tblr}{
colspec={Q[l,m]Q[l,m]},
hlines={dashed},
column{1}={fg=red,rightsep+=.2em},
column{2}={font=\scriptsize,leftsep+=.2em},
% stretch=3.5,
rows = {ht = 3\baselineskip},
}
\begin{varwidth}{4em}
四个个字
\end{varwidth}&
\begin{varwidth}{50em}
六个个个个字\texttt{Sixxxx}四个个字,六个个个个字
\end{varwidth}\\
\begin{varwidth}{4em}
四个个字
\end{varwidth}&
\begin{varwidth}{50em}
十二个个个个个个个个个字,五个个个字
\end{varwidth}\\
\begin{varwidth}{4em}
四个个字
\end{varwidth}&
\begin{varwidth}{50em}
八个个个个个个字,九个个个个个个个字
\end{varwidth}\\
\end{tblr}
\end{document}
P.S 上述的7点需求似乎只有「2」与问题核心有关....为了让潜在的回答者少看文字,其他的内容或许可以更加省略...
\documentclass[border=4pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A, 2/0/B}
\tkzDrawPoints(A,B)
\tkzDrawSegment[-Stealth](A,B)
\tkzDefPointWith[linear,K=1.5](A,B)
\tkzGetPoint{C}
\tkzDefPointWith[linear,K=.75](A,B)
\tkzGetPoint{D}
\tkzDefPointWith[linear,K=-.5](A,B)
\tkzGetPoint{E}
\tkzDrawPoints[violet](C) % 1.5
\tkzDrawPoints[cyan](D) % .75
\tkzDrawPoints[olive](E)% -.5
\tkzLabelPoints[above](A,B,C,D,E)
\tkzDrawLine[gray,dashed,add=1 and 1](A,B)
\end{tikzpicture}
\end{document}
读文档,不难发现...

对于linear normed,参数K为「绝对距离」。
\documentclass[border=4pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A, 2/0/B}
\tkzDrawPoints(A,B)
\tkzDrawSegment[-Stealth](A,B)
\tkzDefPointWith[linear normed,K=1.5](A,B)
\tkzGetPoint{C}
\tkzDefPointWith[linear normed,K=2.5](A,B)
\tkzGetPoint{D}
\tkzDefPointWith[linear normed,K=-1](A,B)
\tkzGetPoint{E}
\tkzDrawPoints[violet](C) % K=1.5 |AC|=1.5,|BD|=0.5
\tkzDrawPoints[cyan](D) % K=2.5 |AD|=2.5,|BD|=0.5
\tkzDrawPoints[olive](E)% K=-1 |EA|=1
\tkzLabelPoints[above](A,B,C,D,E)
\tkzDrawLine[gray,dashed,add=1 and 1](A,B)
\end{tikzpicture}
\end{document}
至此,假如已知BD=4.2的情况下,如何延长BA到点E,并且使AE = BD = 4.2,也就是延长绝对的数量;应该是可以解决了...
假如BD长度未知,如何得到它的长度,并且延长BA到点E,并且使AE = BD的长度
在文档中也有类似的功能\tkzCalcLength

下面把|AB|设置为倾斜的,因此|AB|长度需要通过勾股定理,较难计算。同时我们预期在|AC|上延长这段长度...
\documentclass[border=4pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A, 1.5/0.25/B, 1/1/C}
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B,C)
\tkzDrawSegments[thick](A,B A,C)
%计算|AB|的长度
\tkzCalcLength(A,B)
\tkzGetLength{dAB}
%从C点反向延长距离为\dAB的长度
\tkzDefPointWith[linear normed,K=-\dAB](C,A)
\tkzGetPoint{D}
\tkzDrawSegment[magenta,semithick](A,D)
\tkzDrawPoints[magenta](D)
\tkzLabelPoints[magenta](D)
\tkzDrawSegment[dim={\pgfmathprintnumber\dAB,6pt,}](C,D)
\end{tikzpicture}
\end{document}
挑个软柿子:
可以看到,以上代码高亮也有问题,我希望(原环境)可以高亮命令,比如\begin,\end,\draw等,但现在只能高亮命令名,反斜杠不支持。如果使用minted库,一定程度上可以改进,但minted库需要调用Pygments,编译速度很慢,我希望能规避
这个问题应该与tcolorbox和example无关,可以参考这个链接.
related link
你有任何想法或者做过任何尝试吗?如果有,贴上代码是更好的。
最好不要问「do-it-for-me」类型的问题。
也许可以用表格,然后隐去部分垂直线(?)
P.S.我不太明白为什么此处的水平横线是断开的(?)

主要同幂次项要对齐比较麻烦。
tabularray是多么好评如潮花了我大约50分钟进行微调...
\documentclass{article}
\usepackage{libertinus-otf}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\usepackage{tabularray}
% https://tex.stackexchange.com/a/659657/322482
\begin{document}
\lipsum[1][1-5]
\noindent
\begin{tblr}{
% hlines,
% vlines,
stretch = 2,
colspec = {X[r]*{14}{Q[c]}X[l]},
leftsep = 1pt,rightsep = 1pt,
cells = {mode = dmath},
vline{2,8,16} = {2}{2-Z}{},
hline{4} = {2}{2-Y}{},
hline{6} = {2}{2-7,11-Y}{},
hline{8} = {2}{11-Y}{},
column{1,2,7,8,Y,Z} = {leftsep=6pt,rightsep=6pt},
}
& \SetCell[c=6]{c} g(x) &&&&&&\SetCell[c=8]{c} f(x) & \\
h_2(x)=-\frac{1}{2}+\frac{1}{4} & x^3&+&x^2&-&x&-1& x^4&+&x^3&-3&x^2&-4&x&-1 & x=h_1(x) \\
& x^3&+\frac{3}{2}&x^2&+\frac{1}{2}&x& & x^4&+&x^3&-&x^2&-&x& & \\
& & - \frac{1}{2} & x^2&-\frac{3}{2}&x&-1 &\SetCell[c=3]{r} r_1(x)=&&&-2&x^2&-3&x&-1 &\frac{8}{3}x+\frac{4}{3}=h_3(x) \\
& & - \frac{1}{2} & x^2&-\frac{3}{4}&x&-\frac{1}{4} & &&&-2&x^2&-2&x& & \\
& \SetCell[c=3]{r} r_2(x)=&& & -\frac{3}{4}&x&-\frac{3}{4} & &&&&&-&x&-1 & \\
& & & &&& & &&&&&-&x&-1 & \\
& & & &&& & &&&&&&&0 & \\
\end{tblr}
\lipsum[1][1-5]
\end{document}+/-」的对齐点位....这将得到:

顺便期待一下tikz-matrix的处理方案...
难点就在于:
用aligned可以,不过对齐比较困难,matrix内不支持&对齐。直接用\node加foreach工作量也不小,主要同幂次项要对齐比较麻烦。
可以在y轴方向上缩放一点,让数字字符拉高/低一点
可以在x轴方向上缩放一点,让数字字符拉宽/瘦一点,以上这是两位数字的情况
当三(多)位数字时,在x轴方向上,数字字符可以再瘦一点,在y轴方向上,与两位数字的情况保持一致
其中「三(多)位数字」要「在y轴方向上,与两位数字的情况保持一致」,这样「2」似乎就会被拉长得的又高又瘦(?)个人觉得略显奇怪...
如果只是要调大小的话,也许可以用charshrink来改善「222文字太小」的问题:

\documentclass{ctexart}
\usepackage{tikz}
\usepackage{circledtext}
\newcommand*{\mysingle}[1]{\circledtext[charshrink=.8]{#1}}
\newcommand*{\mydouble}[1]{\circledtext[charshrink=.85]{#1}}
\newcommand*{\mytriple}[1]{\circledtext[charshrink=.92]{#1}}
\begin{document}
\circledtext{2}\circledtext{22}\circledtext{222}
\tikz{\node[scale=5] {\circledtext{2}\circledtext{22}\circledtext{222}};}
\mysingle{2}\mydouble{22}\mytriple{222}
\tikz{\node[scale=5] {\mysingle{2}\mydouble{22}\mytriple{222}};}
\end{document}
side-notes:
pdflatex编译ctexartxe或lua,则无需显式写出UTF8,早已是默认值感谢@u19850 鱼老师...
可以考虑用下面的方式实现将三个命令封装为一个...

另外,真的要自定义新的样式吗?感觉这个工作量跟重写半个circuitikz包差不多大...如果只是新增某个「元件」符号感觉还相对好一点....
这样也许可以避免手动指定xshift=<dim>?

\documentclass{article}
\usepackage[margin=.8in,centering]{geometry}
\usepackage{showframe,lipsum,tikz,tkz-euclide}
\newcommand*{\inserttkz}[1][]{%
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(2.5,0){B}
\tkzDefPoint(1.5,2){C}
\tkzDrawPolygon[#1](A,B,C)
\tkzLabelPoints(A,B,C)
\end{tikzpicture}%
}
\begin{document}
\lipsum[1][1-3]
\fbox{
\begin{tikzpicture}[node distance=.5cm]
\node (O) {\inserttkz};
\node[right=of O] (O1) {\inserttkz[blue]};
\node[right=of O1] (O2) {\inserttkz[magenta]};
\node[right=of O2] (O3) {\inserttkz[olive]};
\end{tikzpicture}
}
\lipsum[1][1-3]
\end{document}
上面是这几天遇到的一个压轴题,请教大家怎么绘制。
其实也还是和tkz-euclide有些关系的
先上完整代码:
\documentclass[border=3pt]{standalone}
\usepackage{libertine}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[scale=1.5,thick,line cap=rounded]
\tkzDefPoints{-1/0/B,1/0/C,0/sqrt(3)/A}
\tkzDefPointWith[linear,K=.35](A,B)\tkzGetPoint{D}
\tkzDefPointWith[linear,K=.35](C,A)\tkzGetPoint{E}
\tkzInterLL(D,C)(B,E) \tkzGetPoint{F}
\tkzDrawPolygon(A,B,C)
\tkzDrawSegments(C,D B,E)
\tkzLabelPoints[left](A,B,D)
\tkzLabelPoints[right](C,E)
\tkzLabelPoints[below](F)
\node at (0,-.5) {Figure 1};
\begin{scope}[xshift=3cm]
\tkzDefPoints{-1/0/B,1/0/C,0/sqrt(3)/A}
\tkzDefPointWith[linear,K=.35](A,B)\tkzGetPoint{D}
\tkzDefPointWith[linear,K=.35](C,A)\tkzGetPoint{E}
\tkzInterLL(D,C)(B,E) \tkzGetPoint{F}
\tkzDrawPolygon(A,B,C)
\tkzDrawSegments(C,D B,E)
\tkzLabelPoints[left](A,B,D)
\tkzLabelPoints[right](C,E)
\tkzLabelPoints[below](F)
%%%%%%%%%%%%%%%%%%%%
\tkzDefPointBy[projection=onto C--D](B) \tkzGetPoint{G}
\tkzDrawSegments(B,G A,G)
\tkzLabelPoints[right](G)
\node at (0,-.5) {Figure 2};
\end{scope}
\begin{scope}[xshift=6cm]
\tkzDefPoints{-1/0/B,1/0/C,0/sqrt(3)/A,0/0/H,0/-0.2/l}
\tkzDrawLine(A,H)
\tkzDrawPolygon(A,B,C)
\tkzLabelPoints[right](l)
%%%%%%%%%%%%%%%%%%%%
\tkzDefPointWith[linear,K=.3](A,H)\tkzGetPoint{M}
%%%%%%%%%%%%%%%%%%%%
\tkzDefTriangle[equilateral](M,C)
\tkzGetPoint{N}
\tkzDrawSegments(B,N A,N)
\tkzDrawPolygon(C,M,N)
\tkzLabelPoints[below left](B,H)
\tkzLabelPoints[below right](C)
\tkzLabelPoints[left=-3pt](M)
\tkzLabelPoints[right=-2pt](N)
\tkzLabelPoints[above left](A)
\node at (0,-.5) {Figure 3};
\end{scope}
\end{tikzpicture}
\end{document}


所以核心代码是:
\tkzDefPointWith[linear,K=.35](A,B)\tkzGetPoint{D}
\tkzDefPointWith[linear,K=.35](C,A)\tkzGetPoint{E}这里的K=0.35是可供调整的参数,我不懂初中几何,算不出来...算得出来准确比例直接写会更准确...
至于求交点,在之前的回答里也已经用过了:
\tkzInterLL(D,C)(B,E) \tkzGetPoint{F}之前的问题也介绍过了,有projection方法:

\tkzDefPointBy[projection=onto C--D](B)
\tkzGetPoint{G}但其实你用了tkz-euclide也不难....熟知等边三角形的英文为equilateral,在文档中搜索即可:

\tkzDefTriangle[equilateral](M,C)
\tkzGetPoint{N}P.S.1 如果没有@u26254 老师的回答,我是万万不会想到用scope的(哭)
P.S.2 最好不要不做任何尝试就提问,单独画每一个图都不算难....
also maybe related:
texdoc tkzexample很有趣的问题...
不知是否如此?
\documentclass[fontset=fandol]{ctexart}
\usepackage[scale=.85,centering,showframe]{geometry}
% https://tex.stackexchange.com/a/231860/322482
\newcounter{mypara}
\AtBeginDocument{\everypar{\refstepcounter{mypara}}}
\newcounter{noteinpar}[mypara]
\NewDocumentCommand{\noteinpar}{ m m }{%
\refstepcounter{noteinpar}%
\textbf{#1}\,\ignorespaces%
% ${}^{\refstepcounter{noteinpar}\thenoteinpar}$%
% \textsuperscript{\thenoteinpar}%
\textsuperscript{\arabic{noteinpar}}%
{\fangsong(#2)}%
}
\begin{document}
劳仑衣\noteinpar{普}{桑},认至将指点效\noteinpar{则}{机},最你\noteinpar{更}{枝}。想极整月正进好志次回总般,段然取向使张规军证回,世市总李率英茄持伴。用阶千样响领交出,器程办管据家元写,名其直金团。化达书据始价算每百青,金低给天济办作照明,取路豆学丽适市确。
如提单各样备再成农\noteinpar{各}{政},设头律走克美技\noteinpar{说}{没},体交才路此\noteinpar{在}{杠}。响育油命转处他住有,一须通给对非交矿今该,花象更面据压来。与花断第然调,很处己队音,程承明邮。常系单要外史按机速引也书,个此少管品务美直管战,子大标蠢主盯写族般本。农现离门亲事以响规,局观先示从开示,动和导便命复机李,办队呆等需杯。见何细线名必子适取米制近,内信时型系节新候节好当我,队农否志杏空适花。又我具料划每地,对算由那基高放,育天孝。派则指细流金义月无采列,走压看计和眼提问接,作半极水红素支花。果都济素各半走,意红接器长标,等杏近乱共。层题提万任号,信来查段格,农张雨。省着素科程建持色被什,所界走置派农难取眼,并细杆至志本。
\end{document}
...
既然你的问题是:
请问除了用raisebox使文本和图片垂直居中外,还有其它方法吗?
自行学习总结吧...
P.S.最好把效果图以「图片」形式贴上去而不是仅以「.PDF」的形式,可方便别人直接在网页上查看。
maybe related:
矛盾点在于:
\left\{和\right.」要被视为一个整体equation x」与「a,b,c」要被视为两个(列)部分不是很优雅的做法,并没有解决上面的矛盾,借助了tag...
\documentclass[12pt]{ctexart}
\usepackage{showframe}
\usepackage{amsmath,amsfonts}
\usepackage{empheq}
\usepackage{lipsum}
\usepackage{mathtools}
\begin{document}
balabala
\begin{equation}
a^2+b^2=c^2
\end{equation}
\lipsum[2]
\newtagform{myempty}{}{}
\usetagform{myempty}
\begin{empheq}[left=\empheqlbrace]{align}
a^2+b^2=c^2, \tag{a} \\
a^2+b^2=c^2, \tag{b} \\
a^2+b^2=c^2, \tag{c}
\end{empheq}
\usetagform{default}%
\lipsum[2]
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document} 或者更优雅一点写成:
\documentclass[12pt]{ctexart}
\usepackage{showframe}
\usepackage{amsmath,amsfonts}
\usepackage{empheq}
\usepackage{lipsum}
\usepackage{mathtools}
\newtagform{myempty}{}{}
\AddToHook{env/empheq/before}{\usetagform{myempty}}
\AddToHook{env/empheq/after}{\usetagform{default}}
\begin{document}
balabala
\begin{equation}
a^2+b^2=c^2
\end{equation}
\lipsum[2]
\begin{empheq}[left=\empheqlbrace]{align}
a^2+b^2=c^2, \tag{a} \\
a^2+b^2=c^2, \tag{b} \\
a^2+b^2=c^2, \tag{c}
\end{empheq}
\lipsum[2]
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document} 
请提供一份能体现你问题的完整代码。
\documentclass开始到\end{document}结束就是使用之后所有段都没有了缩进
\documentclass{article}
\usepackage{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{graypara}{
colback=gray!20,
colframe=white,
boxrule=0pt,
left=5pt, right=5pt,
top=3pt, bottom=3pt,
arc=2pt,
before=\par\noindent,
after=\par\noindent
}
\begin{document}%
\lipsum[2]
\begin{graypara}%
\noindent hour = int(input('Please enter the current hour from 0 to 23: '))
\noindent if hour < 12:
\hangindent=4em
print('Good morning!')
print('Have a nice day.')
\noindent elif hour < 18:
print('Good afternoon!')
\noindent else:
print('Good evening!')
\noindent print('Have a good night.')
\end{graypara}% %注意这里后面的空行
\lipsum[2]
\end{document}这将得到:

其实是有缩进的。
你在设置中写到:
before=\par\noindent,
after=\par\noindent,前者可以让你的整个盒子不缩进,而后者直接让你的盒子后的下一段不缩进(如果你不用空行表示新的一段的话)...
另外,你不需要写那么多的\noindent,似乎也不应该写\hangindent=4em,另外,如果要实现「代码盒子」,你可以看一下文档里的tcblistings环境,最好使用等宽字体。
我不知道你的最终目标是什么(你可以做补充),但我如果是我的话,我会修改成:
\documentclass{article}
\usepackage{showframe}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\usepackage{lipsum}
\newtcblisting{graypara}{
listing only,
colback=gray!20,
colframe=white,
boxrule=0pt,arc=2pt,
left=5pt, right=5pt,
top=3pt, bottom=3pt,
before=\par\noindent,
after=\par,
}
\begin{document}%
\lipsum[2]
% 注意tcblistings中的代码会与你源代码中的缩进保持一致
\begin{graypara}
hour = int(input('Please enter the current hour from 0 to 23: '))
if hour < 12:
print('Good morning!')
print('Have a nice day.')
elif hour < 18:
print('Good afternoon!')
else:
print('Good evening!')
print('Have a good night.')
\end{graypara}
\lipsum[2]
\lipsum[2]
\end{document}
问 Mac系统下 emoji编译