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

注册于 4年前

回答
467
文章
291
关注者
196

提供下你的代码。这样不好弄呀。我整理下答案:

有一个方案就是这样的,listings 有个技巧,就是 。literate 参数用于定义如何处理源代码中的特殊字符,它允许用户指定一个字符和相应的替换文本,从而在显示源代码时进行自定义替换或格式化。

效果如下:

\documentclass[UTF8]{ctexart} % 使用 UTF8 编码和 ctexart 文档类
\usepackage[dvipsnames]{xcolor}
\usepackage{minted} % 语法高亮和代码样式设置方面更加强大和灵活
\usemintedstyle{xcode}
\usepackage{listings}% 引入listings包,用于在文档中插入代码,并可自定义代码样式
\lstset{
    language=c,
    basicstyle=\ttfamily, % 设置字体族
    numbers=left, %行号在左侧显示
    numberstyle= \tiny, %行号字体
    % identifierstyle=\color{black},
    keywordstyle=\bfseries\color{NavyBlue}, % 设置关键字为粗体,颜色为NavyBlue
    morekeywords={}, % 设置更多的关键字,用逗号分隔
    emph={}, % 指定强调词,如果有多个,用逗号隔开
    emphstyle=\bfseries\color{Rhodamine}, % 强调词样式设置
    commentstyle=\itshape\color{black!50!white}, % 设置注释样式:斜体+浅灰色
    columns=flexible %让注释变得紧凑
    stringstyle=\bfseries\color[RGB]{128,0,0}, % 设置字符串样式
    showstringspaces=false, %不显示代码字符串中间的空格标记
    breaklines=true,  %代码过长则换行
    frame=shadowbox, %阴影效果 + 用方框框住代码块
    % backgroundcolor=\color{red!50!green!50!blue!50}, %代码块背景色为浅灰色
    rulesepcolor= \color{ red!20!green!20!blue!20}, %代码块边框颜色
    escapeinside=``, %英文分号中可写入中文
    xleftmargin=2.4em, 
    xrightmargin=0.5em,
    aboveskip=1em,
    framexleftmargin=2em,
    %directivestyle={},
    literate={float.}{float.}6,
}
\usepackage{graphicx}
\title{这是一个中文文章的标题} % 文章标题
\author{作者名} % 作者名字
\date{\today} % 文章日期,使用当前日期

\begin{document}

\maketitle % 生成标题页

\tableofcontents%生成目录
\begin{lstlisting}
#include<stdio.h>
#include<float.h> //这是一个新的库
int main()
float a = 1.0;
#ifdef foo
#else
#endif
printf("Today is a niceday!")
printf("FLT_MIN:%f\n"FLT_MIN);
printf("FLT_MAX:%f\n"FLT_MAX);
printf("DBL_MIN:%f\n"DBL_MIN);
printf("DBL_MAX:%f\n"DBL_MAX);
return0:
\end{lstlisting}

\end{document}

image.png

看看 小 L 的文章都解释清楚了:

https://liam.page/2016/12/11/LaTeX-traditional-font-scheme/

.pfb 文件包含了字符的形状,它们决定了字符在打印(或者预览)中是怎样呈现的。这些文件不会被用户直接调取,而是被引擎或者驱动程序调用。当然,也有 .pfa 文件,它和 .pfb 文件储存的信息完全相同,只不过它是用可见的 ASCII 码字符来储存信息的,因此它会比相应的 .pfb 文件要大出不少。

定制化能力强的是 enumitem,使用起来比较随意的是 enumerate,如果你定制样式要求高,你可以用 enumitem,尽量不要一起用。

可以重定义下 \tableofcontents 如下示例:

\documentclass{article}
\usepackage{multicol,xcolor}

\makeatletter
\setlength{\columnseprule}{1pt}
\renewcommand{\columnseprulecolor}{\color{green}} 
\renewcommand\tableofcontents{%
    \section*{\makebox[\linewidth][c]{\contentsname}%
      \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \begin{multicols}{2}%
    \@starttoc{toc}%
    \end{multicols}
    }
\makeatother

\begin{document}

\tableofcontents

\section{test}

\section{another test}
\end{document} 

效果如下:
image.png

那个字体是要付费购买的字体,一般用户电脑都没有的。最好去掉。

这应该是你的版面代码看看,如果是 twoside 会有版面的左右偏移的,改成 oneside 就好了。

这样设置伪粗体,这样设置:

\setCJKmainfont[AutoFakeBold = {2.15},ItalicFont={[simkai.ttf]}]{SimSun}

或者有个新宏包 https://www.ctan.org/pkg/xfakebold 也是制作粗体非常可行的选择。

最好找找不同字体来看,尤其是 unicode-math 可以设置几个字体,看看,不同字体效果有差异。

比如 mathtime 字体

image.png

还有newtxmath的字体

image.png

选自:https://tex.stackexchange.com/questions/235547/editing-theorem-environments
代码如下:

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}

\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
         top=0mm,
         bottom=0mm,
         right=0mm,
        colback=white,
        colframe=white,
        colbacktitle=white,
        coltitle=black,
        attach boxed title to top left,
        boxed title style={empty, size=minimal, bottom=1.5mm},
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        },
    S/.style={thmbox, 
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        },
    L/.style={thmbox, 
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);},
        },
    LQ/.style={thmbox, 
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
    },  
}

\newtcbtheorem[]{tcbthmbox}{Theorem}{thmbox}{theo}
\newtcbtheorem[]{tcbSthmbox}{Theorem}{thmbox,S}{theo}
\newtcbtheorem[]{tcbLthmbox}{Theorem}{thmbox,L}{theo}
\newtcbtheorem[]{proof}{Démonstration}{thmbox,LQ}{theo}

\begin{document}

\begin{tcbthmbox}{First result}{}
\lipsum[3]
\end{tcbthmbox}

\begin{tcbSthmbox}{Important}{}
\lipsum[2]
\end{tcbSthmbox}

\begin{tcbLthmbox}{Final}{}
\lipsum[1]
\end{tcbLthmbox}

\begin{proof}{Proof}{}
\lipsum[1]
\end{proof}
\end{document}

image.png

代码如下:


\newcommand*\newop{\mathop{\raisebox{-5pt}{\normalfont\Huge K}}}
\begin{equation}
  1 + 1 = 2 \label{eq} \newop_a^b
\end{equation}

效果如下图:
image.png

发布
问题