【问题记录】VS Code & Tex Live 2024 & Latex Workshop badness 10000和badness 1577 error及解决--失败

在 LaTeX 中,badness 是指文本在当前段落中的排版质量。badness 值越高,表示排版效果越差。值范围从 0 到 10,000,其中 10,000 表示 LaTeX 无法将文本合理排版。以下是这两个错误的详细解释和解决方法:

Badness 10000: a-tive error

  • 解释: badness 10000 表示 LaTeX 在当前段落中的排版问题非常严重,通常是由于文本或数学公式过长,LaTeX 无法将其合理地放入一行。a-tive error 表示 LaTeX 在处理文本时将某个单词的前半部分(例如 "active")分割成了不合适的部分,导致排版问题。
  • 解决方法:
    1. 调整段落或内容: 检查段落内容,看看是否有非常长的单词或公式,可以尝试重写或重新组织文本。
    2. 强制换行: 对长单词或公式使用 \linebreak\break 强制换行。
    3. 调整列宽: 如果是在表格中,可以尝试调整列宽或表格布局,使内容更合理地分布。

Badness 1577: square error

  • 解释: badness 1577 表示文本排版存在一定的质量问题,但没有达到最严重的程度。square error 可能与 LaTeX 试图将一段文本强制适配到一个特定的区域有关,比如在表格单元格中。
  • 解决方法:
    1. 调整表格布局: 检查是否有单元格内容过长,导致排版不佳。可以通过调整列宽、行高,或减少单元格内容来解决问题。
    2. 减少表格内容: 如果表格内容过多或过长,考虑缩短或拆分表格。
    3. 使用 \raggedright: 对于单元格中的文本,使用 \raggedright 可以避免文本被过度拉伸。
% 通过调整表格列宽来减少 badness 错误
\begin{tabular}{p{4cm} p{4cm}}
Long text that causes issues & Another long text that might cause square error \\
\end{tabular}

% 对于段落中的文本,可以强制换行
This is a long sentence that might cause badness issues. We can use \linebreak[2] to suggest a line break.

那么问题又来了。对于某些期刊给的latex模板,有要求页边距。如何自适应换行?

模板本身换行,要求一切格式均已模板文件为主,一切变动在模板范围内进行格式编辑。

怀疑tex workshop的settings不对,先在这留一个记录:【有recipe error的记录】

{
   "latex-workshop.latex.tools": [
    {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "biber",
        "command": "biber",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "bibtex",
        "command": "bibtex",
        "args": [
            "%DOCFILE%"
        ] 
    },
    {
        "name": "xelatex",
        "command": "xelatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "latexmk",
        "command": "latexmk",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdf",
            "-outDir-%outDir%",
            "%DOCFILE%"

        ]
    }
],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "biber",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "xelatex",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "lateXmk",
            "tools": [
                "latexmk"
            ]
        }
    ],
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.fls",
        "*.log",
        "*.fdb_latexmk",
        "*.snm",
        "*.synctex(busy)",
        "*.synctex.gz",
        "*.nav",
        "*.vrb"
    ],
    "latex-workshop.latex.autoBuild.run": "onFileChange",
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.synctex.synctexjs.enabled": true,
    "latex-workshop.message.update.show": false,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.intellisense.package.extra": {
        "sn-article": {
            "cmds": [
                "affil",
                "email"
            ],
            "environments": [],
            "options": {
                "affil": [
                    "option"
                ],
                "email": [
                    "option"
                ]
            }
        }
    },
    "latex-workshop.latex.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.bibtex-fields.sort.enabled": true,
    "latex-workshop.intellisense.update.aggressive.enabled": true,
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "latex-workshop.view.pdf.viewer": "tab",
    "workbench.settings.applyToAllProfiles": [
        "latex-workshop.latex.outDir"
    ]

}

将里面biber,换成bibtex:

{
   "latex-workshop.latex.tools": [
    {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "biber",
        "command": "biber",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "bibtex",
        "command": "bibtex",
        "args": [
            "%DOCFILE%"
        ] 
    },
    {
        "name": "xelatex",
        "command": "xelatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "latexmk",
        "command": "latexmk",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdf",
            "-outDir-%outDir%",
            "%DOCFILE%"

        ]
    }
],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "xelatex",
            "tools": [
                "xelatex",
                "bibtex"
            ]
        },
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex",
                "bibtex"
            ]
        },
        {
            "name": "lateXmk",
            "tools": [
                "latexmk",
                "bibtex"
            ]
        }
    ],
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.fls",
        "*.log",
        "*.fdb_latexmk",
        "*.snm",
        "*.synctex(busy)",
        "*.synctex.gz",
        "*.nav",
        "*.vrb"
    ],
    "latex-workshop.latex.autoBuild.run": "onFileChange",
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.synctex.synctexjs.enabled": true,
    "latex-workshop.message.update.show": false,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.intellisense.package.extra": {
        "sn-article": {
            "cmds": [
                "affil",
                "email"
            ],
            "environments": [],
            "options": {
                "affil": [
                    "option"
                ],
                "email": [
                    "option"
                ]
            }
        }
    },
    "latex-workshop.latex.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.bibtex-fields.sort.enabled": true,
    "latex-workshop.intellisense.update.aggressive.enabled": true,
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "latex-workshop.view.pdf.viewer": "tab",
    "workbench.settings.applyToAllProfiles": ["latex-workshop.latex.outDir"
]

}

模板导言备忘

\documentclass[sn-mathphys-num]{sn-jnl}% Math and Physical Sciences Numbered Reference Style 
%%\documentclass[sn-mathphys-ay]{sn-jnl}% Math and Physical Sciences Author Year Reference Style
%%\documentclass[sn-aps]{sn-jnl}% American Physical Society (APS) Reference Style
%%\documentclass[sn-vancouver,Numbered]{sn-jnl}% Vancouver Reference Style
%%\documentclass[sn-apa]{sn-jnl}% APA Reference Style 
%%\documentclass[sn-chicago]{sn-jnl}% Chicago-based Humanities Reference Style

%%%% Standard Packages
%%<additional latex packages if required can be included here>

\usepackage{graphicx}%
\usepackage{multirow}%
\usepackage{amsmath,amssymb,amsfonts}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
\usepackage[title]{appendix}%
\usepackage{xcolor}%
\usepackage{textcomp}%
\usepackage{manyfoot}%
\usepackage{booktabs}%
\usepackage{algorithm}%
\usepackage{algorithmicx}%
\usepackage{algpseudocode}%
\usepackage{listings}%
%%%%

%%%%%=============================================================================%%%%
%%%%  Remarks: This template is provided to aid authors with the preparation
%%%%  of original research articles intended for submission to journals published 
%%%%  by Springer Nature. The guidance has been prepared in partnership with 
%%%%  production teams to conform to Springer Nature technical requirements. 
%%%%  Editorial and presentation requirements differ among journal portfolios and 
%%%%  research disciplines. You may find sections in this template are irrelevant 
%%%%  to your work and are empowered to omit any such section if allowed by the 
%%%%  journal you intend to submit to. The submission guidelines and policies 
%%%%  of the journal take precedence. A detailed User Manual is available in the 
%%%%  template package for technical guidance.
%%%%%=============================================================================%%%%

%% as per the requirement new theorem styles can be included as shown below
\theoremstyle{thmstyleone}%
\newtheorem{theorem}{Theorem}%  meant for continuous numbers
%%\newtheorem{theorem}{Theorem}[section]% meant for sectionwise numbers
%% optional argument [theorem] produces theorem numbering sequence instead of independent numbers for Proposition
\newtheorem{proposition}[theorem]{Proposition}% 
%%\newtheorem{proposition}{Proposition}% to get separate numbers for theorem and proposition etc.

\theoremstyle{thmstyletwo}%
\newtheorem{example}{Example}%
\newtheorem{remark}{Remark}%

\theoremstyle{thmstylethree}%
\newtheorem{definition}{Definition}%

\raggedbottom

模板使用natbib包引用文献

崩溃!爱咋咋地吧

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HelloWorld__来都来了

来都来了 福寿双全

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值