我将获得第一个表的标题大小,就像第二个表一样

我将获得第一个表的标题大小,就像第二个表一样
\documentclass[a4paper,11pt,twoside,openright]{book}

\usepackage[margin=1in]{geometry}


\usepackage[utf8x]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{showkeys}
% \usepackage[dvips]{graphicx}
% per le figure:
\usepackage{graphicx}
% per il testo attorno alle figure
\usepackage{floatflt,epsfig}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{array}
% usare colori in tabella:
\usepackage{xcolor,colortbl}
\usepackage{titlesec}
%tabelle lunghe (gestione oltre il margine)
\usepackage{longtable} 
\usepackage{ltablex}
% \usepackage{lmode rn}
% \usepackage{listings}
% \usepackage[usenames]{color}
% \usepackage{color}
% \usepackage{xcolor}
% \usepackage{xspace}
% \lstset{language=TeX,
%       backgroundcolor=\color{lightgray},
%       basicstyle=\small\ttfamily,
%       xleftmargin=3em}

\pagestyle{fancy}\addtolength{\headwidth}{20pt}
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\#1}{}}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\cfoot{}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}
{\bfseries\thepage}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}
{\bfseries\rightmark}}

\begin{document}
\begin {flushright}
Dedica
\end {flushright}

\tableofcontents

\centering{\scriptsize
\begin{longtable}{|c|m{2,5 cm}|m{3 cm}|m{3 cm}|m{3 cm}|}
\caption{Tabella Relazioni} \\
\rowcolor{orange}
\rule[1ex]{0ex}{3ex}
Relazione&Significato&Attributi&Identificatori&Cardinalità \\

bla bla \\

\bottomrule \\
\end{longtable}}

\begin{table}[!ht]
\centering{\scriptsize
\begin{tabular}{|c|m{4 cm}|m{4.5 cm}|m{3 cm}|}
\rowcolor{orange}
\rule[1ex]{0ex}{3ex}
Entità&Significato&Attributi&Identificatori \\

bla bla \\

\bottomrule
\end{tabular}}
\caption{Tabella Entità}
\end{table}


\end{document}

因此,我希望“Tabella Relazioni”的大小等于“Tabella entità”的大小。我使用 longtable,因为第一个表格无法放在一页中。谢谢!

答案1

我假设您指的是字体大小。为此,我们可以使用caption包并使标题具有正常大小的文本。请记住,\centering不带参数,因此删除其后的括号。

\documentclass{article}
\usepackage{longtable,booktabs}
\usepackage[table]{xcolor}
\usepackage{caption}   %% this added

\begin{document}
  \centering\scriptsize
\begin{longtable}{|c|m{2,5 cm}|m{3 cm}|m{3 cm}|m{3 cm}|}
\captionsetup{font=normalsize}               %% this added
\caption{Tabella Relazioni} \\
\rowcolor{orange}
\rule[1ex]{0ex}{3ex}
Relazione&Significato&Attributi&Identificatori&Cardinalità \\
\bottomrule
\end{longtable}

\begin{table}[!ht]
\centering\scriptsize
\begin{tabular}{|c|m{4 cm}|m{4.5 cm}|m{3 cm}|}
\rowcolor{orange}
\rule[1ex]{0ex}{3ex}
Entità&Significato&Attributi&Identificatori \\
\bottomrule
\end{tabular}
\caption{Tabella Entità}
\end{table}
\end{document}

在此处输入图片描述

相关内容