我在加载颜色包时遇到了问题。我刚刚开始写文档,大约有 90 页。刚才我想添加一些带有颜色的代码列表,所以我加载了颜色包。然后我的整个文档就乱套了,因为图像之间的间距发生了变化,图像开始移动到下一页……有没有办法完全禁止 color 或 xcolor 等颜色包更改间距?这是我的模板:
%% Clear sans, courier
% Klasa:
\documentclass[12pt]{mwart}
% Kodowanie:
\usepackage[utf8]{inputenc}
% odstep w listach
\usepackage[titles]{tocloft}
\addtolength{\cftfignumwidth}{10pt}
% Czcionki:
\usepackage[sfdefault]{ClearSans} %% option 'sfdefault' activates Clear Sans as the default text font
\usepackage[T1]{fontenc}
\usepackage{courier}
\usepackage[T1]{polski}
% Znak euro
\usepackage[official]{eurosym}
% Geometria i style
%\usepackage{showframe} % debug
\usepackage{geometry}
\geometry{a4paper,twoside=true,top=20mm,bottom=30mm,inner=35mm,outer=20mm}
\pagestyle{plain}
\usepackage{float}
\usepackage{afterpage}
% Grafika
\usepackage{graphicx}
\usepackage{epstopdf}
% matma
\usepackage{amssymb,amsmath}
% theoremy
\usepackage{amsthm}
% Stopnie
\usepackage{gensymb}
% Opisy
\usepackage{caption}
\captionsetup[table]{singlelinecheck=off}
% Tabele
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{array}
\usepackage{makecell}
%\usepackage{color}
% Footnoty
\usepackage{footnote}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command
% kody
\usepackage{lipsum}
\usepackage{listings}
% Numerowanie obiektow wedlug rozdzialow
\usepackage{chngcntr}
\AtBeginDocument{\counterwithin{lstlisting}{section}}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\numberwithin{equation}{section}
% Linki
\usepackage{url}
\usepackage{fancyref}
% Listy
\usepackage[ampersand]{easylist}
\ListProperties(Hide=100, Hang=true, Progressive=3ex, Style*=-- ,
Style2*=$\bullet$ ,Style3*=$\circ$ ,Style4*=\tiny$\blacksquare$ )
% Dane:
\title{Uniwersalny inteligentny sterownik silników do zastosowań przemysłowych}
\author{Łukasz Przeniosło}
% Zmienne srodowiskowe:
\newcommand{\paperTitlePl}{UNIWERSALNY INTELIGENTNY STEROWNIK SILNIKÓW DO ZASTOSOWAŃ PRZEMYSŁOWYCH}
\newcommand{\paperTitleEn}{UNIVERSAL INTELIGENT MOTOR DRIVER FOR INDUSTRIAL APPLICATIONS}
\newcommand{\topicChooseDate}{01.08.2015 r.}
\newcommand{\topicAcceptationDate}{01.06.2016 r.}
\newcommand{\tocLessLeft}[1]{\textsc{\textbf{\large \flushleft{#1}}} \vspace{3mm} \\ \indent }
\newcommand{\tocLessLeftNorm}[1]{\textsc{\textbf{\normalsize \flushleft{#1}}} \vspace{0mm} \\ \indent }
\newcommand{\tocLessCenter}[1]{\textsc{\textbf{\large \centerline{#1}}} \vspace{3mm} \\ \indent }
\newcommand{\insertImg}[3]{%
\begin{figure}[h]
\centering
\includegraphics[height=50mm]{#1}
\caption{#2} \flushleft{Źródło: Na podstawie \cite{#3}}
\label{#1}
\end{figure}
}
\newcommand{\insertImgSetSize}[4]{%
\begin{figure}[h]
\centering
\includegraphics[height=#2mm]{#1}
\caption{#3} \flushleft{Źródło: Na podstawie \cite{#4}}
\label{#1}
\end{figure}
}
\newcommand{\insertTab}[5]{%
\begin{savenotes}
\begin{table}[h]
\flushleft{Źródło: Na podstawie \cite{#4}} \\
\vspace{2mm}
\centering
\begin{tabular}{#1}
#2
\end{tabular}
\caption{#3}
\label{#5}
\floatstyle{plaintop}
\end{table}
\end{savenotes}
}
% Zmienic jesli jednak Engineering -.- ...
\newcommand{\firma}{{Mechatronic Systems}}
% twierdzenia
\newtheorem{defn}{Definicja}[section]
% Indeksowanie w pdfie wyjsciowym
\usepackage{hyperref}
% Naprawienie referencji do figur i tabel
\renewcommand{\theHfigure}{figure.section.thesection.\thefigure}
% START:
\begin{document}
some text text text
\insertImgSetSize{example-image-a}
{40}
{1st image}
{badcite}
some text text text
\insertImgSetSize{example-image-a}
{50}
{1st image}
{badcite}
some text text text
\insertImgSetSize{example-image-a}
{60}
{1st image}
{badcite}
some text text text
\insertImgSetSize{example-image-a}
{50}
{1st image}
{badcite}
\end{document}
编辑:我已更新示例,现在可以粘贴并运行了。请注意颜色包在第 53 行被注释掉了。编译代码并查看文档。然后取消注释颜色包并编译,您将看到间距增加。有没有办法禁用这种间距增加?
答案1
你使用错误\flushleft
\newcommand{\insertImg}[3]{%
\begin{figure}[h]
\centering
\includegraphics[height=50mm]{#1}
\caption{#2}\label{#1}
\raggedright Źródło: Na podstawie \cite{#3}
\end{figure}
}
\newcommand{\insertImgSetSize}[4]{%
\begin{figure}[h]
\centering
\includegraphics[height=#2mm]{#1}
\caption{#3}\label{#1}
\raggedright Źródło: Na podstawie \cite{#4}
\end{figure}
}
\newcommand{\insertTab}[5]{%
\begin{savenotes}
\begin{table}[h]
\raggedright Źródło: Na podstawie \cite{#4}\\
\vspace{2mm}
\centering
\begin{tabular}{#1}
#2
\end{tabular}
\caption{#3}
\label{#5}
\floatstyle{plaintop}
\end{table}
\end{savenotes}
}