Sagittarius Rover
Sagittarius Rover
不喜欢LaTeX!!!

注册于 2年前

回答
48
文章
0
关注者
1

给一个不太成功的尝试....
我在symbols中找不到上面单一的符号....只好找了个类似的代替,上面的符号应该是一种中文书记排版系统里面的某个预定义排版样式,实在是不想,也不会自己画这一样式.
也许有一下两种思路:

  • 使用pifont宏包提供的\dingline命令,缺点是只能使用pifont宏包提供的符号,同时左右间距不可调
  • 基于tikzmarkings实现路径的替换,可见下面的mwe和效果
\documentclass[12pt]{ctexart}
\usepackage[margin=1.5in]{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.markings}
\usepackage{pifont}
\makeatletter
\newcommand{\part@title@box}[1]{
    \stepcounter{part}
    \begin{center}
        {\Huge{\bfseries\kaishu 第\chinese{part}部分} \hspace{.5em} {\songti #1}}\par
        \vspace{2em}
        % \dingline{253} %使用pifont宏包提供的插入单行字符
        \begin{tikzpicture}[
            decoration={
                    markings,
                    mark=between positions 0 and 1 step 3mm with
                    {\node {\ding{248}};}%插入字符...但我实在找不到
                    }
        ]
        \path [postaction={decorate}] (.05\textwidth,0) -- (.95\textwidth,0);
        \end{tikzpicture}
    \end{center}
}
\ctexset{
    part = {
        name = {},
        numbering = false,
        format = \part@title@box,
    },
    section = {
        name = {第,章},
    }
}
\makeatother
\begin{document}
    \part{\LaTeX{}简介}
    \lipsum[1]
    \section{初见\LaTeX{}}
    \lipsum[2]
    \section{再见\LaTeX{}}
    \lipsum[3]
    \part{\LaTeX{}入坑}
    \section{又见\LaTeX{}}
    \lipsum[2-6]
\end{document}

image.png

希望各位提供更好的处理方式,共同交流学习!

贴一个在群里贴过的也许有帮助的链接.感觉要从字体层面复刻是蛮困难的事情.

https://ctan.org/tex-archive/macros/latex/contrib/psnfssx/mathtime在这个页面可以找到mathtime.dtx,文件

不太明白你想问什么?

CTAN上的tkz-euclide宏包就是英文的,官方没有发布过任何版本的tkz-euclide中文文档.你想获取中文版文档只能尝试搜索是否有人翻译了该宏包.

想获得中文版宏包可以自己发起/参与一些翻译宏包的项目,例如中文版文档翻译项目.

可以尝试fancyhdr文档中的做法

image.png

\documentclass[11pt,a4paper,twoside]{article}
\usepackage{ctex}
\usepackage{fancyhdr}
\usepackage{lipsum}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}
\pagestyle{fancy}
\chead{页眉}   

\usepackage{marginnote}

\begin{document}

\lipsum[2] \marginnote{边栏文本}

\lipsum[3-7] \marginnote{另一段边栏文本}

\end{document}

image.png

如果我是正在学习tikz-3d可能是一个不错的final-exam...看上去聪明如GPT也不懂tikz...

多给点悬赏也许有空的时候可以试试

对于在命令行使用fc-list没有看懂的问题,是因为cmd默认使用的是GBK编码,可以输入chcp命令查看当前编码,如果为936则会出现上述乱码的问题,可以通过chcp 65001更改为UTF-8编码,此后可以重新执行fc-list | findstr "FZShuSong-Z01"查看字体的中文名称.

此外,在不涉及版权问题的前提下,可否提供一下MWE以方便本地调试....

此外我印象中指定本地字体文件时似乎要加上后缀名.ttf(可以尝试尝试)

image.png

我懂你的痛苦,我也被fontspec狠狠折磨过

我在思考...是否应该提供一个MWE的压缩包方便别人调试测试...
MMWWEE.jpg

诚如@u38442 的解释,我又尝试了一下,下面是测试的结果.

按我个人理解,minipage环境的作用是用来对齐文字环境内的「小页面」,因此默认是按照baseline居中对齐的,你想要实现和控制的是多个minipage之间的垂直对齐关系,而minipage会根据内容自动设置高度,例如下图,自动匹配的高度不统一导致了你的问题.

image.png

可以尝试指定可选的 [height] 参数来实现.
下面是一个MWE和效果.

image.png

\documentclass[aspectratio=169]{ctexbeamer}
\usepackage{lipsum}
\usepackage{graphicx}
\begin{document}
\begin{frame}{给minipage加框并展示inner-pos参数的区别}
    \fbox{
        \begin{minipage}[c][5cm][t]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image-a}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][5cm][c]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image-b}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][5cm][b]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image-c}
        \end{minipage}
    }
\end{frame}
%---------------------------------------------------------------------------------%
\begin{frame}{3个minipage都顶部对齐}
    \fbox{
        \begin{minipage}[c][.2\textheight][t]{.28\textwidth}
            \centering
            苹果.
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][.2\textheight][t]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][.2\textheight][t]{.28\textwidth}
            \centering
            苹果.
        \end{minipage}
    }
\end{frame}
%---------------------------------------------------------------------------------%
\begin{frame}{3个minipage都居中对齐}
    \fbox{
        \begin{minipage}[c]{.28\textwidth}
            \centering
            苹果.
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c]{.28\textwidth}
            \centering
            橘子.
        \end{minipage}
    }
\end{frame}
%---------------------------------------------------------------------------------%
\begin{frame}{3个minipage都居底对齐}
    \fbox{
        \begin{minipage}[c][.2\textheight][b]{.28\textwidth}
            \centering
            苹果.
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][.2\textheight][b]{.28\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}[c][.2\textheight][b]{.28\textwidth}
            \centering
            苹果.
        \end{minipage}
    }
\end{frame}
\begin{frame}{演示minipage设置不同的高度}
    生活就像海洋,只有意志坚强的人才能到达彼岸.生活就像海洋,只有意志坚强的人才能到达彼岸.生活就像海洋,只有意志坚强的人才能到达彼岸.生活就像海洋,只有意志坚强的人才能到达彼岸.
    \fbox{
        \begin{minipage}{.2\textwidth}
            \centering
            这是一小段话.
        \end{minipage}
    }
    \fbox{
        \begin{minipage}{.15\textwidth}
            \centering
            \includegraphics[width=.6\textwidth]{example-image}
        \end{minipage}
    }
    \fbox{
        \begin{minipage}{.15\textwidth}
            \centering
            \includegraphics[width=.8\textwidth]{example-image}
        \end{minipage}
    }
\end{frame}
\end{document}

此外,关于markdown插入代码块的语法,需要如下图做围栏式代码块,markdown语法学习对你来说仍然任重而道远.
image.png
(p.s.上面的{ctexart}花括号打错了,但我懒得再截图...)

另:对于设置对齐方式这种较为精细化的需求,GPT等大模型不一定(往往不能)可以提供准确的解答,更好的办法(几乎也是唯一的办法)是阅读宏包的文档.可以搜索一下texdoc <package name>命令,当然如果你是在overleaf上使用的话,可以尝试检索CTAN+<package name>.但其实对于精细需求我个人是不建议使用大模型帮助的,"GPT不懂LaTeX".

祝好!

我不是很明白你是怎么每次复制MWE都复制成这样的(你只要把 documentclass 到end{document}之间的所有内容放到一个markdown代码块 ' ' ' '之间,就能把他们全都高亮框内)

此外,rule插入的并不是一个图片.建议使用mwe插入图片以构造mwe,同时我不是很确明白使用minipage给出的结果你有不满意吗,还是你正在学习beamer以遍历所以实现图文混排的方式,如果是后者,那非常不错!

image.png

经过测试,我发现只需要使用对齐选择 T 即可实现,具体细节可见texdoc beamer
image.png

下面是一个MWE和结果

\documentclass[aspectratio=169]{ctexbeamer}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{mwe}
\begin{document}
\begin{frame}{文图文}
    \lipsum[2]
    \begin{columns}[T]
        \begin{column}{.32\textwidth}
            \centering
            苹果\hfill
        \end{column}
        \begin{column}{.32\textwidth}
            \centering
            \includegraphics[width=\textwidth]{example-image}
        \end{column}
        \begin{column}{.32\textwidth}
            \centering
            香蕉
        \end{column}
    \end{columns}
\end{frame}
\end{document}

image.png

按照我对这个网站粗浅的理解....
我觉得你要区分好 提问(问答)以及文章投稿,前者时用于提问交流问题的,后者适用于发布分享你使用latex做了一些什么,或者有什么新的功能,以及自己的学习感悟之类的问题.查看你的主页,你似乎并未发布作品

  • 在提问板块,如果问题尚未采纳,可以通过以下补充问题按钮对问题正文进行修改。

image.png

  • 在提问板块后的评论区(comment),本网站似乎暂无修改的功能(tse上面是可以的),也许可以新增一个comment来修改或补充你的问题.
  • 在发布文章的板块,如果要修改的话,应该需要联系超管@u30 后台处理吧.

绘制正方体调整角度用的是什么宏包的什么命令呢?也许需要一个更具体的绘图框架。

搬运

https://tex.stackexchange.com/questions/722777/how-to-achieve-the-layout-of-figure-with-vertical-and-horizonal-placement

我来测试一下使用不同语言样式代码块的显示效果...

def fibonacci(n):
    fib_sequence = [0, 1]
    for i in range(2, n):
        next_number = fib_sequence[-1] + fib_sequence[-2]
        fib_sequence.append(next_number)
    return fib_sequence[:n]
# 输出前10个斐波那契数列的数字
print(fibonacci(10))
% LaTeX文档示例
\documentclass{article}
\usepackage[utf8]{inputenc}

\title{我的第一个LaTeX文档}
\author{作者名字}
\date{}

\begin{document}

\maketitle

\section{正文}
这里是文章的主体内容。

\subsection{子标题}
这里是子标题下的内容。

\end{document}
% LaTeX3宏包开发示例
\documentclass{article}
\usepackage{expl3}

\ExplSyntaxOn
\cs_new:Npn \my_macro:n #1
  {
    \tl_upper_case:n {#1}
  }
\ExplSyntaxOff

\begin{document}

这是原始文本:Hello World!

这是转换后的文本:\my_macro:n {Hello World!}

\end{document}

什么语言样式也不添加

def fibonacci(n):
    fib_sequence = [0, 1]
    for i in range(2, n):
        next_number = fib_sequence[-1] + fib_sequence[-2]
        fib_sequence.append(next_number)
    return fib_sequence[:n]
\documentclass{article}
\usepackage{expl3}

\ExplSyntaxOn
\cs_new:Npn \my_macro:n #1
  {
    \tl_upper_case:n {#1}
  }
\ExplSyntaxOff

\begin{document}

这是原始文本:Hello World!

这是转换后的文本:\my_macro:n {Hello World!}
\end{document}

文档其实写的很详细了
使用命令行编译后可以发现需要在当前目录下新建一个solutions文件夹,tbc会将solution写入该文件夹
这是由savelowerto命令指定的
image.png
你不能编译的一大原因是找不到solutions文件夹

你还有其他一些问题
例如没有引入amsmath,调用skins和xparse库的方式都不对等原因

目录结构应如下【注意应自己建一个solutions文件夹】
image.png

下面是实测可以运行的MWE

\documentclass{ctexart}
\usepackage[margin=1.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tcolorbox}
\usepackage{xcolor}
\tcbuselibrary{skins,xparse}

\NewTColorBox[auto counter,number within=section]{exercise}{+!O{}}{%
    enhanced,colframe=green!20!black,colback=yellow!10!white,coltitle=green!40!black,
    fonttitle=\bfseries,
    underlay={\begin{tcbclipinterior}
    \shade[inner color=green!80!yellow,outer color=yellow!10!white]
    (interior.north west) circle (2cm);
    \draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
    (interior.south west) grid (interior.north east);
    \end{tcbclipinterior}},
    title={Exercise~\thetcbcounter:},
    label={exercise@\thetcbcounter},
    attach title to upper=\quad,
    after upper={\par\hfill\textcolor{green!40!black}%
    {\itshape Solution on page~\pageref{solution@\thetcbcounter}}},
    lowerbox=ignored,
    savelowerto=solutions/exercise-\thetcbcounter.tex,
    record={\string\solution{\thetcbcounter}{solutions/exercise-\thetcbcounter.tex}},
    #1
}
\NewTotalTColorBox{\solution}{mm}{%
enhanced,colframe=red!20!black,colback=yellow!10!white,coltitle=red!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
\shade[inner color=red!50!yellow,outer color=yellow!10!white]
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Solution of Exercise~\ref{exercise@#1} on page~\pageref{exercise@#1}:},
phantomlabel={solution@#1},
attach title to upper=\par,
}{\input{#2}}
\tcbset{no solution/.style={no recording,after upper=}}

\tcbstartrecording\relax
\begin{document}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=\sin((\sin x)^2)
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( \sin((\sin x)^2) \right)'
        =\cos((\sin x)^2) 2\sin x \cos x.
    \end{align*}
\end{exercise}
\begin{exercise}[no solution]
    It holds:
    \begin{equation*}
        \frac{d}{dx}\left(\ln|x|\right) = \frac{1}{x}.
    \end{equation*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=(\sin(\sin x))^2
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( (\sin(\sin x))^2 \right)'
        =2\sin(\sin x)\cos(\sin x)\cos x.
    \end{align*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=\sqrt{x^3-6x^2+2x}
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( \sqrt{x^3-6x^2+2x} \right)'
        = \frac{3x^2-12x+2}{2\sqrt{x^3-6x^2+2x}}.
    \end{align*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=\left(\frac{2+3x}{1-2x}\right)^3
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( \left(\frac{2+3x}{1-2x}\right)^3 \right)'
        = 3 \left(\frac{2+3x}{1-2x}\right)^2 \frac{(1-2x)3-(2+3x)(-2)}{(1-2x)^2}
        = \frac{21(2+3x)^2}{(1-2x)^4}.
    \end{align*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=\frac{\cos x}{(\tan 2x)^2}
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( \frac{\cos x}{(\tan 2x)^2} \right)'
        = \left( \frac{\cos x (\cos 2x)^2}{(\sin 2x)^2} \right)'                       \\
              & = \frac{(\sin 2x)^2 [(-\sin x)(\cos 2x)^2+(\cos x)4\cos 2x (-\sin 2x)]
        - \cos x (\cos 2x)^2 4\sin 2x \cos 2x}{(\sin 2x)^4}                            \\
              & = -\frac{\cos(2x) [\sin x \sin 2x \cos 2x+ 4\cos x(\sin 2x)^2
        + 4 \cos x (\cos 2x)^2]}{(\sin 2x)^3}                                          \\
              & = -\frac{\cos(2x) [\sin x \sin 2x \cos 2x+ 4\cos x]}{(\sin 2x)^3}.
        152
    \end{align*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=\cos((2x^2+3)^3)
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( \cos((2x^2+3)^3) \right)'
        =-\sin((2x^2+3)^3) 3(2x^2+3)^2 2\cdot 2x   \\
              & =-12x(2x^2+3)^2\sin((2x^2+3)^3).
    \end{align*}
\end{exercise}
\begin{exercise}
    Compute the derivative of the following function:
    \begin{equation*}
        f(x)=(x^2+1)\sqrt{x^4+1}
    \end{equation*}
    \tcblower
    The derivative is:
    \begin{align*}
        f'(x) & = \left( (x^2+1)\sqrt{x^4+1} \right)'
        = 2x\sqrt{x^4+1} + \frac{2x^3(x^2+1)}{\sqrt{x^4+1}}.
    \end{align*}
\end{exercise}
\tcbstoprecording

\tcbinputrecords

\end{document}

多看看文档,多看看lshort,你给的MWE实际上还有一些自己乱添加的东西,注意MWE的定义
MWE.jpg

同时还要注意要得到page的索引还得至少进行两次xelatex的编译....
以及尽量避免 弄了半天还是不行 这种信息量很低的话,具体是哪里不行?命令行运行的报错是什么?你的期望效果是什么?
下面是压缩包文件,Happy Texing!

mmmwe.zip

不太清楚上述现象出现的原因:
但可以使用usepackage{ctex}其会默认设置行距为1.3倍可以解决你的问题;或者直接使用linespread{1.3}获得如下的效果。

image.png

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\linespread{1.3} %设置行距
\begin{table}[htbp]
    \begin{tblr}{*{5}{Q[c,m]}}
        \toprule
        \SetCell[r=2]{c} hASDFp
                & \SetCell[c=2]{m} {hZXCVp} &        &  & \SetCell[c=2]{m} {hIUYTp} &        \\
        \cmidrule{2-3} \cmidrule{5-6}
                & hOIUYTfp                  & hCVFRp &  & hSDEWp                    & PLOIKp \\
        \midrule
        hZXCVBp & 0.30                      & 0.64   &  & 0.25                      & 0.48   \\
        \bottomrule
    \end{tblr}
\end{table}%

\end{document}

建议使用tabularray宏包精细化排版表格
下面是一个MWE

\documentclass[12pt]{ctexart}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table}[htbp]
    \begin{tblr}{Q[c,m]*{2}{Q[c,m,7em]}} % texdoc tabularray中的Q列格式设置
        \toprule
         & value1 & value2        \\
        \midrule
        {par par par par par      \\par text} & 114 &  514 \\
        {par par                  \\ par par par par text} & 114 &  514 \\
        {想在这里换行同时保持居中 \\ 文本} & 114 &  514 \\
        \bottomrule
    \end{tblr}
\end{table}
\end{document}

image.png

发布
问题