平均能量损失
\documentclass[a4paper,11pt]{book}
\usepackage{caption}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{float}
\newfloat{Grafik}{htbp}{loa}
\begin{document}
\chapter{A}
\section{B}
\begin{figure}[h!]\centering
\includegraphics[scale=.4]{example-image-a}
\captionof{figure}{Image}
\end{figure}
\begin{center}
\def\width{3}
\def\hauteur{3}
\begin{tikzpicture}[x=1cm, y=1cm, semitransparent]
\draw[step=1mm, line width=0.1mm, black!30!white] (0,0) grid (\width,\hauteur);
\draw[step=5mm, line width=0.2mm, black!40!white] (0,0) grid (\width,\hauteur);
\draw[step=5cm, line width=0.5mm, black!50!white] (0,0) grid (\width,\hauteur);
\draw[step=1cm, line width=0.3mm, black!90!white] (0,0) grid (\width,\hauteur);
\end{tikzpicture}
\captionof{Grafik}{Bla Bla}
\end{center}
\end{document}
并输出
我如何打印Grafik 1.1
…… Grafik 1.2
?
并且\newfloat{Graf\/ik}{htbp}{loa}
不起作用。
答案1
有
\newfloat
一个可选参数来指定计数器是否应在分段级别内使用:要更改 floatname,您可以使用
\floatname{Grafik}{Graf\/ik}
\documentclass[a4paper,11pt]{book}
\usepackage{caption}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{float}
\newfloat{grafik}{htbp}{loa}[chapter]
\floatname{grafik}{Graf\/ik}
\begin{document}
\chapter{A}
\section{B}
\begin{figure}[h!]\centering
\includegraphics[scale=.4]{example-image-a}
\caption{Image}
\end{figure}
\begin{grafik}
\centering
\def\width{3}
\def\hauteur{3}
\begin{tikzpicture}[x=1cm, y=1cm, semitransparent]
\draw[step=1mm, line width=0.1mm, black!30!white] (0,0) grid (\width,\hauteur);
\draw[step=5mm, line width=0.2mm, black!40!white] (0,0) grid (\width,\hauteur);
\draw[step=5cm, line width=0.5mm, black!50!white] (0,0) grid (\width,\hauteur);
\draw[step=1cm, line width=0.3mm, black!90!white] (0,0) grid (\width,\hauteur);
\end{tikzpicture}
\caption{Bla Bla}
\end{grafik}
\end{document}