So fügen Sie einen \newcommand in \maketitle ein

So fügen Sie einen \newcommand in \maketitle ein

Ich verwende LaTeX zum ersten Mal und brauche wirklich Hilfe. Ich schreibe meinen Seminarbericht für die Uni.

Ich kann den neuen Befehl nicht \namesigauf der Titelseite anzeigen lassen.

Bildbeschreibung hier eingeben

Hier ist der .texCode

\documentclass[a4 paper,12pt]{report}
\usepackage[hmargin=4.5cm,
vmargin=4.5cm]{geometry} 
%%Name of the Title and subtitle
\title{%
  The uIP Stack \\
  \large A Small Memory Footprint TCP/IP Stack for Microcontrollers\\
  } 
%% First Page of the Report
\author{Mohammad Arshad Ali \\ 
{ECE-A}\\
{B.E. 4/4}\\
{2451-15-735-040}\\
}
%% Signature of the Guide
\newcommand{\namesig}[2][5cm]{%
\begin{tabular}{@{}p{#1}@{}}
    #2 \\[2\normalbaselineskip] \hrule \\[0pt]
    {\small \textit{Signature}} 
  \end{tabular}
}

\begin{document}
\maketitle
\noindent \namesig{Dr. K. Usha}\hfill \namesig{Sudhir Dakey}
\end{document}

Ich weiß, dass es viele ähnliche Beiträge gibt, aber ich kann die Quellcodes nicht richtig kombinieren.

Bitte geben Sie mir auch Tipps, wo ich Quellcodes finden kann, die speziell auf meine Anforderungen zugeschnitten sind, d. h. eine Dokumentation oder ein Lehrbuch, in dem ich die Quellcodes mit einer kurzen Erklärung finden kann.

Antwort1

Sie können es einfach neu definieren, \maketitleum das zu tun, was Sie brauchen:

Bildbeschreibung hier eingeben

\documentclass[a4 paper,12pt]{report}
\usepackage[hmargin=4.5cm,
vmargin=4.5cm]{geometry} 
%%Name of the Title and subtitle
\title{%
    The uIP Stack \\
    \large A Small Memory Footprint TCP/IP Stack for Microcontrollers\\
} 
%% First Page of the Report
\author{Mohammad Arshad Ali \\ 
    {ECE-A}\\
    {B.E. 4/4}\\
    {2451-15-735-040}
}
%% Signature of the Guide
\newcommand{\namesig}[2][5cm]{%
    \begin{tabular}{@{}p{#1}@{}}
        #2 \\[2\normalbaselineskip] \hrule \\[0pt]
        {\small \textit{Signature}} 
    \end{tabular}
}
\makeatletter
\renewcommand{\maketitle}{
    \begin{center}

        \pagestyle{empty}
        \phantom{.}  %necessary to add space on top before the title
        \vspace{3cm}

        {\Huge \bf \@title\par}
        \vspace{2.5cm}

        {\LARGE \@author}\\[1cm]

        {\Large\@date}

        \vspace{4.5cm}
    \noindent \namesig{Dr. K. Usha}\hfill \namesig{Sudhir Dakey}
        %if you want something in the bottom of the page just use /vfill before that.

    \end{center}
}\makeatother

\begin{document}
    \maketitle
\end{document}

Antwort2

Mit Hilfe der titlepageUmgebung kannst du so etwas erreichen. Schriftgrößen, Ausrichtungen und Abstände kannst du natürlich deinen Bedürfnissen anpassen:

Bildbeschreibung hier eingeben

\documentclass[a4 paper,12pt]{report}
\usepackage[hmargin=4.5cm,vmargin=4.5cm]{geometry} 

\newcommand{\namesig}[2][5cm]{%
\begin{tabular}{@{}p{#1}@{}}
    #2 \\[2\normalbaselineskip] \hrule \\[0pt]
    {\small \textit{Signature}} 
  \end{tabular}
}

\begin{document}
\begin{titlepage}
\centering
\vspace*{2cm}
\LARGE The uIP Stack 

\large A Small Memory Footprint TCP/IP Stack for Microcontrollers
\vspace{2cm}

Mohammad Arshad Ali \\ 
{ECE-A}\\
{B.E. 4/4}\\
{2451-15-735-040}\\
\vspace{1cm}

\today

\vspace{5cm}

\namesig{Dr. K. Usha}\hfill \namesig{Sudhir Dakey}

\end{titlepage}
\end{document}

verwandte Informationen