Giter Club home page Giter Club logo

Comments (8)

RuixiZhang42 avatar RuixiZhang42 commented on August 12, 2024 4

另:官方 https://www.mdpi.com/authors/latex 提供的模板写成这样也是醉了……这种 CTAN 上面没有的 class 或 package 很难排查错误……

现在对现有问题做一个整体分析吧:

  1. algorithmic 环境是通过 list 来实现逐行排版算法的,即每一行算法其实是跟在 \item 之后排版的。
  2. mdpi.cls 通过极其不正确的方法更改 \item 的定义,就为了使用它定义的 \itemsep,模板负分。

如果你一定要用 algorithmic,那么可以通过向导言区添加如下代码实现:

\usepackage{etoolbox}
\AtBeginEnvironment{algorithmic}
  {\let\item\olditem}

这模板简直了……

from forum.

RuixiZhang42 avatar RuixiZhang42 commented on August 12, 2024

源代码里面的小毛病挺多的,这里只回答涉及 algorithmic 行距的问题。

首先,请去掉 algorithmic 里的手动换行 \\,一共 3 处。

其实,并不是行距问题——第 1 行算法(4 行文本)与第 2 行算法(2 行文本)的内部是没有问题的,出问题的是这两行算法之间的间距。

改进方法:

% 加在导言区
\usepackage{etoolbox}
\makeatletter
\expandafter\patchcmd\csname\string\algorithmic\endcsname
  {\itemsep\z@}
  {\itemsep=2ex plus2pt\relax}% 根据个人喜好修改 2ex plus2pt 弹性距离
  {}{}
\makeatother

真·改进方法:把算法重写,文本描述精简一些,不要一行算法出现多行文本描述。

from forum.

TaihuLight avatar TaihuLight commented on August 12, 2024

@OsbertWang 您的方法会将所有行距都变大,问题只是每行算法之间的距离太小。
@RuixiZhang42 你给的改进方法,我加入导言区域后没有效果,可否提供下您修改后的全部源码?

from forum.

RuixiZhang42 avatar RuixiZhang42 commented on August 12, 2024

你给的改进方法,我加入导言区域后没有效果

那就是 class 的问题了,你试试把 mdpi.cls 里的这句注释掉:

\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem}

大概看了一下 mdpi.cls,代码写得不好。例如上面这个修改 \itemsep 的方法是很糟糕的,应该通过 enumitem 这些宏包来实现才对。

from forum.

TaihuLight avatar TaihuLight commented on August 12, 2024

@RuixiZhang42
谢谢你的帮助,
最后我将mdpi.cls中你提示的那句话前面的一句中的-7pt修改为-2pt这个问题就解决了。

%% Bullet lists
\addtolength{\wideitemsep}{-2pt}  %原来是 addtolength{\wideitemsep}{-7pt} 
\let\olditem\item
\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem}

from forum.

RuixiZhang42 avatar RuixiZhang42 commented on August 12, 2024

不对啊,我修改的 class 是这样的:

%%%% Bullet lists
\newlength{\wideitemsep}
\setlength{\wideitemsep}{.5\itemsep}
\addtolength{\wideitemsep}{-7pt}
\let\olditem\item
%\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem}

然后这是我得到的结果:

noissue

一切正常……

from forum.

TaihuLight avatar TaihuLight commented on August 12, 2024

@RuixiZhang42 我重新再在试了下,我们两个的方法都可以实现算法行距的更改,但是会导致每条参考文献之间的间距变大。
所以,还是要想办法在算法这个区域进行修改。

from forum.

TaihuLight avatar TaihuLight commented on August 12, 2024

方便留下你的联系方式吗,有空的话,麻烦你帮我【有偿】调一个学位论文的Latex模板。
或者你加我Q 2320763254 也可以

from forum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.