尽量减少考试标题中的多余空格以及可能的改进

尽量减少考试标题中的多余空格以及可能的改进

我是一名数学教育工作者,更喜欢使用 LaTeX 来排版文档。但是,我们学院的院长为我们提供了一个 Word 版本,用于创建考试标题。我尝试将其转换为 LaTeX,如下所示:

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc} % not needed in new latex versions
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm,mathtools,systeme}
\usepackage[tikz]{bclogo}
\usepackage{tikz,tkz-tab,moreverb} % tableau de signe moreverb not needed
\usetikzlibrary{arrows}
%----------
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
%----------
\usepackage[french]{babel}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
\usepackage[usestackEOL]{stackengine}
\usepackage{verbatim}
\usepackage{color}
\usepackage[final]{pdfpages} %pour inserer une page pdf
\usepackage{awesomebox} %takecare
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.0cm,bottom=1.5cm}
%\usepackage{setspace}
%\onehalfspacing
%---- pages numbers with tikz---
\usepackage{fancyhdr}
\usepackage{lastpage}
\usetikzlibrary{shapes}
\fancypagestyle{mypagestyle}{%
    \renewcommand{\headrulewidth}{0pt}
    \fancyhf{}
    \fancyfoot[C]{\tikz{ \node [rectangle, draw = black] (rectangle) at (0,0) {\thepage/\pageref{LastPage}}   }}
}
\pagestyle{mypagestyle}
%----New Structure Exercice -----
\newtheoremstyle{sboxexc}% name of the style to be used
  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}%  of space to indent
  {\bfseries}% name of head font
  {}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}}% Manually specify head
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newtheorem*{Exc}{\shadowbox{\ding{228} Exercice \arabic{counter}\optionaltext}}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont\mbox{}\par}
\newcommand{\finexo}{\renewcommand{\optionaltext}{}\end{Exc}\addtocounter{counter}{1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\isEquivTo}[1]{\underset{#1}{\sim}}
\newcommand*{\transp}[2][-3mu]{\ensuremath{\mskip1mu\prescript{\smash{\mathrm t\mkern#1}}{}{\mathstrut#2}}}%
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\rg}{rg}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\vect}{Vect}
\DeclareMathOperator{\mat}{Mat}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{sfaxlogo}{RGB}{127,176,206}
\colorlet{sfaxblue}{sfaxlogo!70!black!60!blue}
%\pagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------------------------
    \usepackage[column=0]{cellspace}
    \setlength{\cellspacetoplimit}{10.4pt}
    \setlength{\cellspacebottomlimit}{10.4pt}
%------------------------------------------------
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%begin entete%%%%%%%%%%%%%%%%%%%%%%%%%%%
 {\scriptsize\bfseries  \begin{tabular}{|@{}c@{}|c|@{}c@{}|}
      \cline{1-1}  \cline{3-3}
      \begin{tabular}{c}
 Ministère de l'Enseignement\\
 Supérieur\\
 et de la Recherche Scientifique\\
\textbf{-- -- -- $\star\star\star$ -- -- --}\\
 Université de xxxxx\\
\textbf{-- -- -- $\star\star\star$ -- -- --}\\
 Faculté des Sciences \'Economiques\\
 et de Gestion de xxxxx\\
        \vspace{-0.5cm}\includegraphics[width=3cm]{example-image} \\
      \end{tabular}
      & &
     \begin{tabular}{0l|p{8cm}}
         Matière & Mathématiques II (Analyse)\\ \hline
         Niveau et Filière & Première année (Licence en Sciences \'Economiques)\\ \hline
         Enseignant & Monsieur xxxxxxxxxxxx\\ \hline
         Session & Principale (Juin 2023) \\ \hline
         Durée & 2 heures\\ \hline
       Nombre de Pages & 2 \\
      \end{tabular}\\
      \cline{1-1}  \cline{3-3}
    \end{tabular}
%-------------- FIN DE L'ENTETE----------------------
\vspace{0.2cm}

\noindent{\underline{\bf Directives pédagogiques :}}
\begin{itemize}
  \item [\circled{R}] Aucune documentation n'est permise.
  \item [\circled{R}] La qualité de la rédaction, la clarté et la précision des interprétations entreront pour une part importante dans l'appréciation finale.
\end{itemize}}
%\vspace{-0.5cm}
%%%%%%%%%%%%%%%% début exercice%%%%%%%%%%%%%%%%%%%
\exo{: ($4$ points)}

\finexo
%%%%%%%%%%%%%%%% fin exercice%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% début exercice%%%%%%%%%%%%%%%%%%%
\exo{: ($5$ points)}

\finexo
%%%%%%%%%%%%%%%% fin exercice%%%%%%%%%%%%%%%%%%%
%-encouragement--
\begin{flushright}
  {\large\ding{95}} {\large\ding{95}}
\emph{\textbf{\underline{Bon travail}}} {\large\ding{95}}
{\large\ding{95}}
\end{flushright}
%---
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

在此处输入图片描述

但是,标题占用了大量空间。我想尽量减少多余的空间。此外,任何改进建议都值得赞赏。我希望第二个表格的末尾与文本边界处于同一水平。

答案1

以下是两种不同的修复方法:

姆韦

第一个(推荐)是使用 tabulary、multirow 和 array 的单个表格,另一个是嵌套的 tabulars,其中包含注释的修复,以及 tabularx 以适合文本边界,正如您在上次编辑中所要求的那样

(注意:在编辑中,请添加您需要澄清问题的内容,但不要删除/更改原始帖子,因为这样评论或答案对其他用户来说可能毫无意义)。

(注意:为了简化示例,我删除了与问题无关的序言部分,但也许您的工作文档中需要这些部分。因此,要检查工作文档中的解决方案,请不要更改序言,只需添加提到的包(即,只需添加下面代码的第二行。)

\documentclass[12pt,a4paper]{article}
\usepackage{tabularx,tabulary,multirow,array} 
\usepackage{graphicx,amsthm,mathtools}
\usepackage{tikz} 

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}

\usepackage[french]{babel}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement

\usepackage{geometry}\geometry{left=1.5cm,right=1.5cm,top=1.0cm,bottom=1.5cm}

\newtheoremstyle{sboxexc}% name of the style to be used
  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}%  of space to indent
  {\bfseries}% name of head font
  {}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}}% Manually specify head
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newtheorem*{Exc}{\shadowbox{\ding{228} Exercice \arabic{counter}\optionaltext}}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont\mbox{}\par}
\newcommand{\finexo}{\renewcommand{\optionaltext}{}\end{Exc}\addtocounter{counter}{1}}

\usepackage[column=0]{cellspace}
\setlength{\cellspacetoplimit}{9pt}
\setlength{\cellspacebottomlimit}{9pt}


\begin{document}


% Method 1: A single table

\begin{table}[t]
\scriptsize\bfseries
\renewcommand\arraystretch{3.3}%
\extrarowheight-2pt
\begin{tabulary}{\linewidth}{|C|L|l|l|}
\cline{3-4}\cline{1-1}
\multirow{6}{=}{\centering
 Ministère de l'Enseignement \par Supérieur  \par et de la Recherche Scientifique\par
\textbf{-- -- -- $\star\star\star$ -- -- --}\par
 Université de xxxxx\par
\textbf{-- -- -- $\star\star\star$ -- -- --}\par
 Faculté des Sciences \'Economiques \par et de Gestion de xxxxx\par
\medskip\includegraphics[width=3cm]{example-image} 
}
& & Matière & Mathématiques II (Analyse)\\\cline{3-4}
& & Niveau et Filière & Première année (Licence en Sciences \'Economiques)\\\cline{3-4}
& & Enseignant & Monsieur xxxxxxxxxxxx\\\cline{3-4}
& & Session & Principale (Juin 2023) \\\cline{3-4}
& & Durée & 2 heures\\\cline{3-4}
& & Nombre de Pages & 2 \\\cline{1-1}\cline{3-4}
\end{tabulary}
\end{table}

% Method 2: Fix your table with tabularx 


 {\scriptsize\bfseries  \noindent\begin{tabularx}{\linewidth}{|@{}c@{}|X|@{}c@{}|}
      \cline{1-1}  \cline{3-3}
      \begin{tabular}{c}
 Ministère de l'Enseignement\\
 Supérieur\\
 et de la Recherche Scientifique\\
\textbf{-- -- -- $\star\star\star$ -- -- --}\\
 Université de xxxxx\\
\textbf{-- -- -- $\star\star\star$ -- -- --}\\
 Faculté des Sciences \'Economiques\\
 et de Gestion de xxxxx\\
\includegraphics[width=3cm]{example-image} \\
      \end{tabular}
      & &
     \begin{tabular}{0l|p{8.3cm}}
         Matière & Mathématiques II (Analyse)\\ \hline
         Niveau et Filière & Première année (Licence en Sciences \'Economiques)\\ \hline
         Enseignant & Monsieur xxxxxxxxxxxx\\ \hline
         Session & Principale (Juin 2023) \\ \hline
         Durée & 2 heures\\ \hline
       Nombre de Pages & 2 \\
      \end{tabular}\\
      \cline{1-1}  \cline{3-3}
    \end{tabularx}

\vspace{0.2cm}

\noindent{\underline{\bf Directives pédagogiques :}}
\begin{itemize}
  \item [\circled{R}] Aucune documentation n'est permise.
  \item [\circled{R}] La qualité de la rédaction, la clarté et la précision des interprétations entreront pour une part importante dans l'appréciation finale.
\end{itemize}}
\exo{: ($4$ points)}
\finexo
\exo{: ($5$ points)}
\finexo
\begin{flushright}
  {\large\ding{95}} {\large\ding{95}}
\emph{\textbf{\underline{Bon travail}}} {\large\ding{95}}
{\large\ding{95}}
\end{flushright}
%---
\end{document}

此外,我们非常感谢任何改进建议。

好的:

平均能量损失

\documentclass[12pt,a4paper]{article}
\usepackage{tabularx,tabulary,multirow,array,booktabs,xcolor} 
\usepackage{pgfornament} 
\usepackage{graphicx,amsthm,mathtools}

\usepackage[french]{babel}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement

\usepackage{geometry}\geometry{left=1.5cm,right=1.5cm,top=1.0cm,bottom=1.5cm}

\newtheoremstyle{sboxexc}% name of the style to be used
  {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
  {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
  {\itshape}% name of font to use in the body of the theorem
  {0pt}%  of space to indent
  {\bfseries}% name of head font
  {}% punctuation between head and body
  { }% space after theorem head; " " = normal interword space
  {\thmname{#1}}% Manually specify head
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newtheorem*{Exc}{\shadowbox{\ding{228} Exercice \arabic{counter}\optionaltext}}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont\mbox{}\par}
\newcommand{\finexo}{\renewcommand{\optionaltext}{}\end{Exc}\addtocounter{counter}{1}}


\begin{document}


\begin{table}[t]
\renewcommand\arraystretch{2.3}%\extrarowheight-2pt
\footnotesize
\begin{tabularx}{\linewidth}{p{5.2cm}X>{\color{green!40!black}\sffamily}l>{\color{blue!40!black}\sffamily}l}
\toprule
\multirow{6}{=}{\centering%\bfseries
 Ministère de l'Enseignement Supérieur et de la Recherche Scientifique


\pgfornament[width=2cm]{83}

 Université de xxxxx\par

\pgfornament[width=2cm]{83}

Faculté des Sciences Économiques et de Gestion de xxxxx

\medskip\includegraphics[width=3cm]{example-image} 

}
& &  Matière:  & Mathématiques II (Analyse)\\
& & Niveau et Filière:  & Première année (Licence en Sciences \'Economiques)\\
& & Enseignant: & Monsieur Dr. Moreau \\
& & Session: & Principale (\today) \\
& & Durée: & 2 heures\\
& & Nombre de Pages: & 2 \\\bottomrule
\end{tabularx}
\end{table}


\subsubsection*{Directives pédagogiques:}

\begin{itemize}\itemsep1ex
  \item [\textregistered] Aucune documentation n'est permise.
  \item [\textregistered] La qualité de la rédaction, la clarté et la précision des interprétations entreront pour une part importante dans l'appréciation finale.
\end{itemize}

\exo{: ($4$ points)}
\finexo
\exo{: ($5$ points)}
\finexo
\begin{flushright}
  {\large\ding{95}} {\large\ding{95}}
\emph{\textbf{\underline{Bon travail}}} {\large\ding{95}}
{\large\ding{95}}
\end{flushright}
%---
\end{document}

答案2

好吧,因为你已经做了一些高级格式,我想知道为什么我们不能只使用\resizebox{<*width-value*>}{<*height-value*>}{<*content*>}包含两个表格形式,如果行高似乎有问题答案很清楚。我知道这应该放在你问题的评论部分,但我没有足够的声誉来这样做。

相关内容