有时,我会遇到这样的问题:我的文本边距似乎不受尊重。
请看这里的示例: 图像(绿色阴影)不符合我的文本下边距。部分页脚线与图像不符。
一些代码摘录:
% preamble
%!TeX program = pdflatex
\documentclass[10pt, twocolumn]{article}
\usepackage{geometry}
\geometry{
a4paper,
top=1.6cm,
bottom=1.6cm,
left=1.2cm,
right=1.2cm,
headheight=14pt,
headsep=0.28cm,
footskip=0.65cm,
showframe
}
\setlength{\columnsep}{0.5cm}
\usepackage{fancyhdr}
\usepackage{lastpage}
\fancypagestyle{defaultHeadFootWithLine}{
\fancyhead{} % clear all header fields
\fancyhead[L]{\sffamily header blabla}
\fancyhead[C]{\sffamily \MyTitle}
\fancyhead[R]{\sffamily \MyDate}
\fancyfoot{} % clear all footer fields
\fancyfoot[L]{\sffamily school blabla}
\fancyfoot[C]{\sffamily \thepage\ von \pageref*{LastPage}}
\fancyfoot[R]{\sffamily \MyAuthor}
}
% in document
\subsubsection{Halbaddierer}
\includegraphics[width=0.8\columnwidth]{DT_00_HalfAdder.png}
你知道问题可能出在哪里吗?我做错了什么?以下是背面的完整代码:https://de.overleaf.com/read/xxxmksynjtdz
全部代码在这里:
%!TeX program = pdflatex
\documentclass[10pt, twocolumn]{article}
% --- packages --------------------------------------------------------------------------------
\usepackage[svgnames]{xcolor} % Https://mirror.foobar.to/CTAN/macros/latex/contrib/xcolor/xcolor.pdf
\usepackage{tabularray} % for table formatting
\usepackage[normalem]{ulem} % underline mit \uline
\usepackage{mathtools} % must be loaded before fonts
% --- Fonts and Encoding ----------------------------------------------------------------------
% --- Math -----------------------------------------------------------------------------------
\usepackage{physics} % derivatives etc.
\usepackage{siunitx}
\AtBeginDocument{\RenewCommandCopy\qty\SI}
\sisetup{per-mode=fraction, fraction-function=\frac}
% --- Sprache ---------------------------------------------------------------------------------
\usepackage[nswissgerman]{babel} % Neue Rechtschreibung Schweiz
% --- Title -----------------------------------------------------------------------------------
\usepackage{authoraftertitle} % access \author, \title and \date via \MyAuthor, ...
\title{Digitaltechnik (DT) Zusammenfassung}
\author{the author}
\date{\today}
% --- Page Setup ------------------------------------------------------------------------------
\usepackage{geometry}
% https://www.overleaf.com/learn/latex/Page_size_and_margins
\geometry{
a4paper,
top=1.6cm,
bottom=1.6cm,
left=1.2cm,
right=1.2cm,
headheight=14pt,
headsep=0.28cm,
footskip=0.65cm,
showframe
}
\setlength{\columnsep}{0.5cm}
% --- Header and Footer -----------------------------------------------------------------------
\usepackage{fancyhdr}
\usepackage{lastpage}
\fancypagestyle{defaultHeadFootWithLine}{
\fancyhead{} % clear all header fields
\fancyhead[L]{\sffamily header blabla}
\fancyhead[C]{\sffamily \MyTitle}
\fancyhead[R]{\sffamily \MyDate}
%\renewcommand{\headrule}{\hrule height 0.5pt} % Line
\fancyfoot{} % clear all footer fields
\fancyfoot[L]{\sffamily school blabla}
\fancyfoot[C]{\sffamily \thepage\ von \pageref*{LastPage}}
\fancyfoot[R]{\sffamily \MyAuthor}
%\renewcommand{\footrule}{\hrule height 0.5pt \vspace{-0.5mm}} % Line
}
% --- Headings Spacing ------------------------------------------------------------------------
\usepackage{titlesec}
% Adjust styles
%\titleformat{\part}[hang]%{\sffamily\Huge\bfseries\scshape}{}{0em}{}
% {\Huge\sffamily\fontseries{k}\selectfont}{\partformat}{1em}{\vspace*{0pt}}
% \newcommand{\partformat}{\partname\ \thepart}
\titleformat{\section} {\sffamily\Large\bfseries}{}{0em}{} % remove section number (instead of {\thesection}{1em}{})
\titleformat{\subsection} {\sffamily\large\bfseries}{}{0em}{}
\titleformat{\subsubsection}{\color{black!86}\sffamily\bfseries}{}{0em}{}
\titleformat*{\paragraph} {\color{black!86}\sffamily\bfseries}
% Adjust spacing around section titles
%\titlespacing{\part}{0pt}{0pt}{0pt}
\titlespacing{\section} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\subsection} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\subsubsection} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\paragraph} {0pt}{6pt}{0pt} % indent, before, after
% Table of Contents
\setcounter{tocdepth}{2} % Set the table of contents depth to 2
% --- Paragraph Spacing -----------------------------------------------------------------------
\usepackage{enumitem}
\newlength{\currparskip}
\setlength{\currparskip}{4pt plus1pt} % default paragraph spacing
\usepackage[skip=\currparskip, indent=0pt]{parskip}
% --- Table Spacing ---------------------------------------------------------------------------
\SetTblrInner{rowsep=2pt}
% --- Quotes ----------------------------------------------------------------------------------
\usepackage[
left = \flqq{},
right = \frqq{},
leftsub = \flq{},
rightsub = \frq{}
]{dirtytalk}
% --- Configure graphicx ----------------------------------------------------------------------
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{wrapfig} % for wrapping images around text
% --- Date Styles -----------------------------------------------------------------------------
\usepackage{datetime2}
\DTMsetup{useregional=num}
% --- Hyperlinks ------------------------------------------------------------------------------
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\begin{document} %=============================================================================
\pagestyle{defaultHeadFootWithLine}
% --- Title Page ------------------------------------------------------------------------------
\renewcommand{\familydefault}{\sfdefault}
{
\sffamily
\maketitle
\tableofcontents
}
\renewcommand{\familydefault}{\rmdefault}
\thispagestyle{empty}
\clearpage
\pagenumbering{arabic}
% --- Content ---------------------------------------------------------------------------------
\section{Grundlagen}
\section{Placeholder}
\subsection{Analog vs. Digital}
analog: zeit- und wert\uline{kontinuierlich}, digital: zeit- und wert\uline{diskret}
\subsubsection{Vorteile Digitaltechnik}
\begin{itemize}
\item Robustheit gegenüber Störungen
\item Miniaturisierung möglich, Aufwand an Transistoren nicht limitierend
\item Automatisierung beim Entwickeln von IC's $\rightarrow$ Massenproduktion
\item Leistungsfähigkeit aufgrund hoher Taktraten
\end{itemize}
\subsection{FPGA}
Array aus generischen logischen Blöcken, wobei jeder Block aus D-FF, LUT und MUX besteht. \\
Hinzu kommen Makrozellen (DSP, RAM, PLL, IO)
\section{Schaltalgebra}
\subsection{Operationen}
\begin{itemize}[nosep]
\item !: NOT
\item \&: AND
\item \#: OR
\end{itemize}
\subsection{Normalformen}
\subsubsection{Beispiel WT}
\begin{tblr}{width=\columnwidth, colspec={X[c] X[c] X[c] | X[c]}}
C & B & A & Y \\
\hline
0 & 0 & 1 & 1 \\
0 & 1 & 1 & 0 \\
1 & 1 & 0 & 0 \\
1 & 1 & 1 & 1
\end{tblr}
\subsubsection{Disjunktive Normalform (1er)}
Die disjunkte Normalform ist die OR-Verknüpfung aller 1-Terme.
\verb|Y = (!C & !B & A) # (C & B & A)|
\subsubsection{Konjunktive Normalform (0er)}
Die konjunktive Normalform ist die AND-Verknüpfung aller 0-Terme, wobei die Terme mit inv. Eingängen OR-verknüpft werden.
\verb|Y = !( (!C & B & A) # (C & B & !A) )| \\
\texttt{\phantom{Y }= (C \# !B \# !A) \& (!C \# !B \# A)}
\section{Binäre Arithmetik}
\subsubsection{Halbaddierer}
\includegraphics[width=0.8\columnwidth]{DT_00_HalfAdder.png}
\subsubsection{Volladdierer}
\includegraphics[width=0.8\columnwidth]{DT_00_HalfAdder.png}
\end{document}
答案1
将图表封装在figure
环境中似乎很有帮助,至少对于手头的代码示例而言。
%!TeX program = pdflatex
\documentclass[10pt,twocolumn,demo]{article} % remove 'demo' option in real doc.
% --- packages --
\usepackage[document]{ragged2e} % optional but recommended
\usepackage[T1]{fontenc} % <-- new
\usepackage[svgnames]{xcolor}
\usepackage{tabularray} % for table formatting
\usepackage[normalem]{ulem} % underline mit \uline
\usepackage{mathtools} % must be loaded before fonts % you sure 'bout this??
% --- Fonts and Encoding -------------------------
% --- Math -----
\usepackage{physics} % derivatives etc.
\usepackage{siunitx}
\AtBeginDocument{\RenewCommandCopy\qty\SI}
\sisetup{per-mode=fraction, fraction-function=\frac}
% --- Sprache ---
\usepackage[nswissgerman]{babel} % Rechtschreibung CH
% --- Title -----
\usepackage{authoraftertitle} % access \author, \title and \date via \MyAuthor, ...
\title{Digitaltechnik (DT) Zusammenfassung}
\author{the author}
\date{\today}
% --- Page Setup
\usepackage{geometry}
\geometry{
a4paper,
top=1.6cm,
bottom=1.6cm,
left=1.2cm,
right=1.2cm,
headheight=14pt,
headsep=0.28cm,
footskip=0.65cm,
showframe
}
\setlength{\columnsep}{0.5cm}
% --- Header and Footer --------------------------
\usepackage{fancyhdr}
\usepackage{lastpage}
\fancypagestyle{defaultHeadFootWithLine}{
\fancyhead{} % clear all header fields
\fancyhead[L]{\sffamily header blabla}
\fancyhead[C]{\sffamily \MyTitle}
\fancyhead[R]{\sffamily \MyDate}
%\renewcommand{\headrule}{\hrule height 0.5pt} % Line
\fancyfoot{} % clear all footer fields
\fancyfoot[L]{\sffamily school blabla}
\fancyfoot[C]{\sffamily \thepage\ von \pageref*{LastPage}}
\fancyfoot[R]{\sffamily \MyAuthor}
%\renewcommand{\footrule}{\hrule height 0.5pt \vspace{-0.5mm}} % Line
}
% --- Headings Spacing ---------------------------
\usepackage{titlesec}
\titleformat{\section} {\sffamily\Large\bfseries}{}{0em}{} % remove section number (instead of {\thesection}{1em}{})
\titleformat{\subsection} {\sffamily\large\bfseries}{}{0em}{}
\titleformat{\subsubsection}{\color{black!86}\sffamily\bfseries}{}{0em}{}
\titleformat*{\paragraph} {\color{black!86}\sffamily\bfseries}
\titlespacing{\section} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\subsection} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\subsubsection} {0pt}{6pt}{0pt} % indent, before, after
\titlespacing{\paragraph} {0pt}{6pt}{0pt} % indent, before, after
% Table of Contents appearance:
\setcounter{tocdepth}{2}
\usepackage{enumitem}
% --- Paragraph Spacing --------------------------
\newlength{\currparskip}
\setlength{\currparskip}{4pt plus1pt} % default paragraph spacing
\usepackage[skip=\currparskip, indent=0pt]{parskip}
% --- Table Spacing ------------------------------
\SetTblrInner{rowsep=2pt}
% --- Quotes ----
\usepackage[
left = \flqq{},
right = \frqq{},
leftsub = \flq{},
rightsub = \frq{}
]{dirtytalk}
% --- Configure graphicx -------------------------
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{wrapfig} % for wrapping images around text
% --- Date Styles --------------------------------
\usepackage{datetime2}
\DTMsetup{useregional=num}
% --- Hyperlinks
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\begin{document}
\pagestyle{defaultHeadFootWithLine}
% --- Title Page
\renewcommand{\familydefault}{\sfdefault}
{
\sffamily
\maketitle
\tableofcontents
}
\renewcommand{\familydefault}{\rmdefault}
\thispagestyle{empty}
% --- Content ---
\clearpage
\pagenumbering{arabic}
\section{Grundlagen}
\section{Placeholder}
\subsection{Analog vs. Digital}
analog: zeit- und wert\uline{kontinuierlich},
digital: zeit- und wert\uline{diskret}
\subsubsection{Vorteile Digitaltechnik}
\begin{itemize}
\item Robustheit gegenüber Störungen
\item Miniaturisierung möglich, Aufwand
an Transistoren nicht limitierend
\item Automatisierung beim Entwickeln von IC's
$\to$ Massenproduktion
\item Leistungsfähigkeit aufgrund hoher Taktraten
\end{itemize}
\subsection{FPGA}
Array aus generischen logischen Blöcken, wobei jeder Block aus D-FF, LUT und MUX besteht.
Hinzu kommen Makrozellen (DSP, RAM, PLL, IO)
\section{Schaltalgebra}
\subsection{Operationen}
\begin{itemize}[nosep]
\item !: NOT
\item \&: AND
\item \#: OR
\end{itemize}
\subsection{Normalformen}
\subsubsection{Beispiel WT}
\begin{tblr}{width=\columnwidth, colspec={X[c] X[c] X[c] | X[c]}}
C & B & A & Y \\
\hline
0 & 0 & 1 & 1 \\
0 & 1 & 1 & 0 \\
1 & 1 & 0 & 0 \\
1 & 1 & 1 & 1
\end{tblr}
\subsubsection{Disjunktive Normalform (1er)}
Die disjunkte Normalform ist die
OR-Verknüpfung aller 1-Terme.
\verb|Y = (!C & !B & A) # (C & B & A)|
\subsubsection{Konjunktive Normalform (0er)}
Die konjunktive Normalform ist die AND-Verknüpfung aller 0-Terme, wobei die Terme mit inv. Eingängen OR-verknüpft werden.
\verb|Y = !( (!C & B & A) # (C & B & !A) )| \\
\texttt{\phantom{Y }= (C \# !B \# !A) \& (!C \# !B \# A)}
\section{Binäre Arithmetik}
\subsubsection{Halbaddierer}
\begin{figure}[htbp]
\includegraphics[width=0.8\columnwidth]{DT_00_HalfAdder.png}
\end{figure}
\newpage % <-- force a column break
\subsubsection{Volladdierer}
\begin{figure}[htbp]
\includegraphics[width=0.8\columnwidth]{DT_00_HalfAdder.png}
\end{figure}
\end{document}