自定义 newlistof{Floats}

自定义 newlistof{Floats}

我正在为“盒子”(或封闭的表格)构建自定义列表。请注意,它们不能被命名为表格。

将框添加为环境的唯一方法是通过 Floats。这里的任何提示都可能有帮助。类似于 \begin{table1} \begin{table2}

经过一段时间的研究,几乎一切都好了,但我需要对其进行更多的定制。

这是我的盒子列表(Quadros)现在的样子: 在此处输入图片描述

这是原版的“LOF”,我的应该长得像这个 在此处输入图片描述

主要问题是添加“盒子“ 1 ”“第一个框浮点数...... 3”,如 \listoffigures 中所示

我的实际代码是:

\documentclass[
12pt,
a4paper,
oneside,
brazil           
]{abntex2}          

% ---------- PACOTES -----------------------------------------------

\usepackage[T1]{fontenc}    
\usepackage{times}          
\usepackage[latin1]{inputenc} 
\usepackage{float}          
\usepackage{babel}  
\usepackage[singlelinecheck=off]{caption}  % alinhamento do titulo da  tabela   


\hypersetup{pdfborder = {0 0 0}}

% ---------- DECLARING FLOAT 1 -----------------------------------

    \usepackage{listings}
    \usepackage{tocloft}


        \newcommand{\quadroname}{Quadro}
        \newcounter{quadroname}

        \floatstyle{plaintop}
        \newfloat{Quadro}{hbtp}{loq}
        \newlistof{listofquadros}{loq}{\listofquadrosname}

%   - Ajuste do Float       
        \setfloatadjustment{Quadro}{\centering}
        \renewcommand{\arraystretch}{1.5}


%   - Cria a lista
        \newcommand{\listofquadrosname}{Lista de Quadros}



%   - Configurações adicionais  
!!!! ((((( IF I USE THIS BLOCK IT WILL LOOK EXACTLY LIKE FIGURE (  FIGURE 1 - First Box Float )

%\makeatletter
%\renewcommand*{\listof}[2]{
%   \@ifundefined{ext@#1}{\float@error{#1}}{%
%       \expandafter\let\csname l@#1\endcsname \l@figure
%       \float@listhead{#2}%
%       \begingroup
%       \setlength\parskip{0pt plus 1pt}%               
%       \@starttoc{\@nameuse{ext@#1}}%
%       \endgroup}}
%\makeatother



% ---------- INICIO DO DOCUMENTO ------------------------------------

\begin{document}


% ---------- LISTS --------------------------------------------------


    \pdfbookmark[0]{\listofquadrosname}{s}
    \listof{quadro}{Lista de Quadros}
    \cleardoublepage


    \listoffigures
    \cleardoublepage


% ---------- QUADROS ------------------------------------------------


Any text refering to  \autoref{quad:ex1}

\begin{quadro}
    \caption{First Box Float}
    \begin{tabular}{|c|c|c|}
        \hline
        text1   & text3 & text5   \\ \hline
        text2   & text4 & text6   \\ \hline
    \end{tabular}
    \label{quad:ex1}
\end{quadro}



\begin{quadro}
    \caption{Second Box Float}
    \begin{tabular}{|c|c|c|}
        \hline
        text1   & text3 & text5   \\ \hline
        text2   & text4 & text6   \\ \hline
    \end{tabular}
    \label{quad:ex2}
\end{quadro}


Text linking to \autoref{quad:ex3}


\begin{figure}[hbtp]
    \centering
    \caption{The first figure}
    \begin{tabular}{|c|}
        \hline \\ \hline
    \end{tabular}
    \label{quad:ex3}
    \legend{Fonte: O autor}
\end{figure}


\end{document}

答案1

由于abntex2基于memoir,因此您应该使用此类的方法。

\documentclass[
  12pt,
  a4paper,
  oneside,
  brazil           
]{abntex2}          

% ---------- PACOTES -----------------------------------------------

\usepackage[T1]{fontenc}    
\usepackage{times}          
\usepackage{babel}  
\usepackage[singlelinecheck=off]{caption}  % alinhamento do titulo da  tabela   


\hypersetup{pdfborder = {0 0 0}}

% ---------- DECLARING FLOAT 1 -----------------------------------

\usepackage{listings}

\newcommand{\quadroname}{Quadro}
\newcommand{\listofquadrosname}{Lista de Quadros}

\newfloat{quadro}{loq}{\quadroname}
\setfloatadjustment{quadro}{\centering}
\newlistof{listofquadros}{loq}{\listofquadrosname}
\newlistentry{quadro}{loq}{0}
\renewcommand{\cftquadroname}{\quadroname\space} 
\renewcommand{\cftquadroaftersnum}{\hfill\textendash\hfill}


% ---------- INICIO DO DOCUMENTO ------------------------------------

\begin{document}


% ---------- LISTS --------------------------------------------------


\pdfbookmark[0]{\listofquadrosname}{s}
\listofquadros
\cleardoublepage


\listoffigures
\cleardoublepage


% ---------- QUADROS ------------------------------------------------


Any text refering to  \autoref{quad:ex1}

\begin{quadro}
    \caption{First Box Float}
    \begin{tabular}{|c|c|c|}
        \hline
        text1   & text3 & text5   \\ \hline
        text2   & text4 & text6   \\ \hline
    \end{tabular}
    \label{quad:ex1}
\end{quadro}



\begin{quadro}
    \caption{Second Box Float}
    \begin{tabular}{|c|c|c|}
        \hline
        text1   & text3 & text5   \\ \hline
        text2   & text4 & text6   \\ \hline
    \end{tabular}
    \label{quad:ex2}
\end{quadro}


Text linking to \autoref{quad:ex3}


\begin{figure}[hbtp]
    \centering
    \caption{The first figure}
    \begin{tabular}{|c|}
        \hline \\ \hline
    \end{tabular}
    \label{quad:ex3}
    \legend{Fonte: O autor}
\end{figure}


\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容