Erstellen einer Vorlage

Erstellen einer Vorlage

Mein Professor gab mir eine Vorlage, die ich zusammengestellt habe, die aber viele Fehler enthielt.

Der Code lautet:

\documentclass[12pt]{article}

\usepackage{rotating,graphics,psfrag,epsfig}

\usepackage{graphicx}
\usepackage{color}

\usepackage{latexsym}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}

\usepackage{multicol}
\usepackage[dvipdfm]{hyperref}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lastpage}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{marvosym}
\newcommand{\ff}{Marzo del 2007}

\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.4pt}

%\usepackage[thickspace]{SIunits}

\usepackage[a]{esvect}
\usepackage{shortlst}

\usepackage{marvosym}
\usepackage[version=3]{mhchem}

\newcommand{\solucion}{\noindent\textbf{Soluci\'on}}
\newcommand{\comentario}{\noindent\textbf{Comentario}}
\newcommand{\nota}{\noindent\textbf{Nota}:}
\newcommand{\suge}{\noindent\textbf{Sugerencia}:}
\newcommand{\analisis}{\noindent\textbf{An\'alisis}}
\newcommand{\modelo}{\noindent\textbf{Modelo}}


\fancyhead[L]{} 
\fancyhead[C]{}
\fancyhead[R]{} 
%
\fancyfoot[L]{http://fisica.usach.cl/$\sim$cesparza/}
%\fancyfoot[C]{\ff} 
\fancyfoot[C]{} 
\fancyfoot[R]{TeoIngMat-EXA1s11.pdf -- 15 noviembre 2011}

\headwidth 18.0cm
\textwidth 18.0cm %18.0cm
\textheight 25.00cm % era25
\oddsidemargin -0.8cm
\evensidemargin -0.8cm
\topmargin -3.5000cm %era  -2.0cm
\columnsep 0.3cm
\parindent 0pt

\newcommand{\ia}{\'{\i}}
\newcommand{\xu}{\rm {\widehat{\bf{x}}}}
\newcommand{\yu}{\rm {\widehat{\bf{y}}}}
\newcommand{\zu}{\rm {\widehat{\bf{z}}}}

\newcommand{\iu}{\mathbf{\hat{\imath}}}
\newcommand{\ju}{\mathbf{\hat{\jmath}}}
\newcommand{\ku}{\mathbf{\hat{\kappa}}}
\newcommand{\kuw}{\mathbf{\widehat{\kappa}}}



\usepackage[dvipdfm]{hyperref}
\hypersetup{ 
pdfauthor = Carlos Esparza Barrera, 
pdftitle = TeoF1-IngMat-EXA1s11.pdf, 
pdfsubject = 2red, 
pdfkeywords [email protected], 
pdfcreator = {LaTeX con la paqueteria hyperref }, 
pdfproducer = {dvpdfm} 
}



\usepackage{type1cm} 
\usepackage{eso-pic}
\usepackage{color} 

\begin{document}

 \psfrag{xu}{$\widehat{\bf{x}}$}
 \psfrag{yu}{$\widehat{\bf{y}}$}
\psfrag{iu}{$\mathbf{\hat \imath}$}
 \psfrag{ju}{$\mathbf{\hat \jmath}$} 
 \psfrag{i}{$\hat \imath$}
 \psfrag{j}{$\hat \jmath$}

\textbf{Departamento de Fisica \hfill Universidad de Santiago de Chile} 

Teoria a Física I (22104)\hfill \textbf{EXAMEN} \hfill Ingeniería Matemática  \vspace{0.1cm}

\hline \hline \vspace{0.2cm}

Prof. Carlos H. Esparza-Barrera \hfill \begin{LARGE} \raisebox{-0.5ex}{\Email}                               
           \end{LARGE}  [email protected] \hfill \begin{LARGE}\Telefon \end{LARGE} ~(56-2-)7181239
\hfill Oficina 27 \\[0.1cm] 

\hline
\begin{itemize}

\item  \begin{large} \textbf{Esta prueba
consta de cuatro problemas, usted debe responder tres de ellos. La
elección es suya y debe indicarla en la hoja. Si responde los cuatro, se considerarán los tres
peor evaluados}\end{large}.  \hfill  Cada problema vale $2,0$ puntos. 

\item Fundamente su razonamiento; haga esquemas explicatorios. Use
l\'apiz  indeleble; en caso contrario, no puede pretender una segunda revisi\'on de su trabajo. Exprese sus
repuestas numéricas con 3 CS.


\item Las situaciones y los valores num\'ericos de los datos suministrados no necesariamente corresponden a
los de un experimento o situaci\'on pr\'actica real.  Se pretende que usted  trabaje cada problema  con
el modelo adecuado en el marco de la  teor\'ia  pertinente y obtenga las predicciones correspondientes. 

\end{itemize}
\hline

\begin{multicols}{2}
\begin{enumerate}


\item problema 1

\item ...

\item ...


\item ...


\item ...


\item ...
\end{enumerate}

Beim Kompilieren in Latex=>PS=>PDF treten die folgenden Fehler auf:

\noalign x4 und Not-Aus falsch platziert.

Ich weiß nicht, wie ich das beheben kann.

Das Ergebnis sollte wie folgt aussehen:

Bildbeschreibung hier eingeben

Nach der letzten horizontalen Zeile habe ich die Probleme so bearbeitet, dass dort kein Text mehr steht, wie Sie im Code sehen können.

Ich musste das noch einmal posten, weil ich im anderen Thread einen Fehler gemacht habe. Ich bin für die Hilfe dankbar und danke im Voraus.

Antwort1

Hier ist ein Beispiel, das, wie ich es sehe, eher im Sinne von LaTeX ist. (Nicht um mit den anderen Antworten zu konkurrieren, sondern um die Vorteile des LateX-Ansatzes für diejenigen zu demonstrieren, die ihn als vorteilhaft erachten).

Wenn Sie viele solcher Dokumente erstellen müssten, könnten Sie eine benutzerdefinierte Präambel (oder ein Paket) nach diesem Muster entwerfen. Dadurch werden Präsentation und Stil vollständig getrennt, sodass die Auszeichnung innerhalb der documentUmgebung vollständig semantisch ist. Und ich denke, es werden auch ziemlich einfache Lösungen verwendet, um den gewünschten Layoutstil zu erreichen.

\documentclass{article}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[margin=1.5in]{geometry}
\usepackage{multicol}

\usepackage{marvosym} % for icons
\usepackage{url} % for e-mail address
\usepackage{sectsty}  % for customizing section font

\sectionfont{\normalsize\bfseries}

% Horizontal rule
\newlength{\normalrulethickness}
\setlength{\normalrulethickness}{0.4pt}
\newcommand{\thinrule}{\noindent\rule{\linewidth}{\normalrulethickness}}
\newcommand{\thickrule}{\noindent\rule{\linewidth}{2\normalrulethickness}}
\newcommand{\doublerule}{%
    \thickrule%
    \llap{\rule[2pt]{\linewidth}{\normalrulethickness}}%
}
% Letterhead at top of page
\newcommand{\letterhead}{%
    \noindent%
    \textbf{\department}\hfill \textbf{\university}\newline
    \course\hfill \documentname\hfill \subject\newline
    \doublerule\par\smallskip
    {\small\noindent%
    \professor\hfill \emailicon\ \email\hfill \phoneicon\ \phone\hfill \office%
    }\par\bigskip%
}

% Commands to set the values in the \letterhead
\newcommand{\setdepartment}[1]{\gdef\department{#1}}
\newcommand{\setuniversity}[1]{\gdef\university{#1}}
\newcommand{\setcourse}[1]{\gdef\course{#1}}
\newcommand{\setsubject}[1]{\gdef\subject{#1}}
\newcommand{\setdocumentname}[1]{\gdef\documentname{#1}}
\newcommand{\setprofessor}[1]{\gdef\professor{#1}}
\newcommand{\setemail}[1]{\gdef\email{\url{#1}}}
\newcommand{\setphone}[1]{\gdef\phone{#1}}
\newcommand{\setoffice}[1]{\gdef\office{#1}}

% Icons in letterhead
\newcommand{\emailicon}{\Email} % from marvosym
\newcommand{\phoneicon}{\Telefon}


% Block of instructions with rule before and after
\newenvironment{instructions}{\thickrule}{\thickrule}

% 2-column exam questions
\newenvironment{examquestions}
    {\begin{multicols}{2}}
    {\end{multicols}}

\newcommand{\pointvalue}[1]{\hfill\mbox{#1}}
\newcommand{\strong}[1]{\textbf{#1}}

\begin{document}
\setdepartment{Departamento de Física}
\setuniversity{Universidad de Santiago de Chile}
\setcourse{Teoría Física (22104)}
\setsubject{Ingeniería Matemática}
\setdocumentname{EXAMEN}
\setprofessor{Prof.~Carlos H.~Esparza-Barrera}
\setemail{[email protected]}
\setphone{(56-2-)7181239}
\setoffice{Oficina 27}

\letterhead

\begin{instructions}
\begin{itemize}
\item \strong{%
Esta prueba consta de cuatro problemas, usted debe responder tres de ellos.
La elección es suya y debe indicarla en la hoja. 
Si responde los cuatro, se considerarán los tres peor evaluados.
}\pointvalue{Cada problema vale $2,0$ puntos.}
\item Fundamente su razonamiento; haga esquemas explicatorios. [\dots]
\item Las situaciones y los valores numéricos de los datos suministrados [\dots]
\end{itemize}
\end{instructions}

\begin{examquestions}

\section{Insectos}
Algunos coleópteros pueden proyectarse verticalmente [\dots]

\section{Esferas de aluminio y fierro}
La masa de un metro cúbio de Al es $2,70 \times 10^3$~kg [\dots] %better to use siunitx 

\end{examquestions}


\end{document}

Bildbeschreibung hier eingeben

Antwort2

Ich habe im Code unten zahlreiche Kommentare hinterlassen, die auf fehlerhaften Code hinweisen, diese Version läuft jedoch fehlerfrei in Latex und PDFLatex.

\documentclass[12pt]{article}

% never load epsfig it is just for emulating latex2.09 documents from 1980's
% rotating might be needed for sideways table, otherwise not
% psfrag doesn't work as is with pdflatex or dvipdfm
% graphics is loaded later
%\usepackage{rotating,graphics,psfrag,epsfig}


\usepackage{graphicx}

% color loaded later
%\usepackage{color}

\usepackage{latexsym}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}


%\usepackage[T1]{fontenc}

\usepackage{multicol}

%%% this is loaded later with different options
%\usepackage[dvipdfm]{hyperref}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lastpage}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{marvosym}
\newcommand{\ff}{Marzo del 2007}

\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.4pt}

%\usepackage[thickspace]{SIunits}

\usepackage[a]{esvect}

% no idea what this is, not in texlive
%\usepackage{shortlst}

\usepackage{marvosym}
\usepackage[version=3]{mhchem}

\newcommand{\solucion}{\noindent\textbf{Soluci\'on}}
\newcommand{\comentario}{\noindent\textbf{Comentario}}
\newcommand{\nota}{\noindent\textbf{Nota}:}
\newcommand{\suge}{\noindent\textbf{Sugerencia}:}
\newcommand{\analisis}{\noindent\textbf{An\'alisis}}
\newcommand{\modelo}{\noindent\textbf{Modelo}}


\fancyhead[L]{} 
\fancyhead[C]{}
\fancyhead[R]{} 
%
% don't use math \sim
\fancyfoot[L]{\url{http://fisica.usach.cl/~cesparza/}}
%\fancyfoot[C]{\ff} 
\fancyfoot[C]{} 
\fancyfoot[R]{TeoIngMat-EXA1s11.pdf -- 15 noviembre 2011}

\headwidth 18.0cm
\textwidth 18.0cm %18.0cm
\textheight 25.00cm % era25
\oddsidemargin -0.8cm
\evensidemargin -0.8cm
\topmargin -3.5000cm %era  -2.0cm
\columnsep 0.3cm

% I left this but having \parindent and \parskip both 0pt
% means that paragraph breaks  are not really visible
\parindent 0pt

\newcommand{\ia}{\'{\i}}

% The  \rm never did anything here and both
% \rm and \bf have been deprecated since 1994
%\newcommand{\xu}{\rm {\widehat{\bf{x}}}}
%\newcommand{\yu}{\rm {\widehat{\bf{y}}}}
%\newcommand{\zu}{\rm {\widehat{\bf{z}}}}
\newcommand{\xu}{\widehat{\mathbf{x}}}
\newcommand{\yu}{\widehat{\mathbf{y}}}
\newcommand{\zu}{\widehat{\mathbf{z}}}

\newcommand{\iu}{\mathbf{\hat{\imath}}}
\newcommand{\ju}{\mathbf{\hat{\jmath}}}
\newcommand{\ku}{\mathbf{\hat{\kappa}}}
\newcommand{\kuw}{\mathbf{\widehat{\kappa}}}



%\usepackage[dvipdfm]{hyperref}
\usepackage{hyperref}
\hypersetup{ 
pdfauthor = Carlos Esparza Barrera, 
pdftitle = TeoF1-IngMat-EXA1s11.pdf, 
pdfsubject = 2red, 
pdfkeywords [email protected], 
pdfcreator = {LaTeX con la paqueteria hyperref }, 
pdfproducer = {dvpdfm} 
}



\usepackage{type1cm} 
\usepackage{eso-pic}
\usepackage{color} 


\DeclareUnicodeCharacter{00ED}{\'{\i}}
\DeclareUnicodeCharacter{00F3}{\'{o}}
\DeclareUnicodeCharacter{00E1}{\'{a}}

\begin{document}



% psfrag doesn't work with pdf backends
% \psfrag{xu}{$\widehat{\bf{x}}$}
% \psfrag{yu}{$\widehat{\bf{y}}$}
%\psfrag{iu}{$\mathbf{\hat \imath}$}
% \psfrag{ju}{$\mathbf{\hat \jmath}$} 
% \psfrag{i}{$\hat \imath$}
% \psfrag{j}{$\hat \jmath$}

\textbf{Departamento de Fisica \hfill Universidad de Santiago de Chile} 

Teoria a Física I (22104)\hfill \textbf{EXAMEN} \hfill Ingeniería Matemática \vspace{0.1cm}

%\hline is only used in tables
%\hline \hline 
\vspace{0.2cm}

Prof. Carlos H. Esparza-Barrera \hfill \begin{LARGE} \raisebox{-0.5ex}{\Email}                               
           \end{LARGE}  [email protected] \hfill \begin{LARGE}\Telefon \end{LARGE} ~(56-2-)7181239
\hfill Oficina 27 

% never end a paragraph with \\
%\\[0.1cm] 

%\hline
\begin{itemize}

\item  \begin{large} \textbf{Esta prueba
consta de cuatro problemas, usted debe responder tres de ellos. La
elección es suya y debe indicarla en la hoja. Si responde los cuatro, se considerarán los tres
peor evaluados}
%Always include a paragraph end _within_ a size change this blank line is needed

\end{large}.  \hfill  Cada problema vale $2,0$ puntos. 

\item Fundamente su razonamiento; haga esquemas explicatorios. Use
l\'apiz  indeleble; en caso contrario, no puede pretender una segunda revisi\'on de su trabajo. Exprese sus
repuestas numéricas con 3 CS.


\item Las situaciones y los valores num\'ericos de los datos suministrados no necesariamente corresponden a
los de un experimento o situaci\'on pr\'actica real.  Se pretende que usted  trabaje cada problema  con
el modelo adecuado en el marco de la  teor\'ia  pertinente y obtenga las predicciones correspondientes. 

\end{itemize}
%\hline

\begin{multicols}{2}
\begin{enumerate}


\item problema 1

\item ...

\item ...


\item ...


\item ...


\item ...
\end{enumerate}

\end{multicols}
\end{document}

Antwort3

Ich zeige, dass einfacher TeX-Code unkomplizierter ist als LaTeX. Um Ihr Prüfungsdokument zu erstellen, können wir Folgendes tun:

\input opmac

{\mubytein=0 
 \mubyte\revquestion ¿\endmubyte \gdef\revquestion{?`}
}
\let\secfont=\seccfont  
\font\mvfont=umvs at12pt 
\def\mvchr#1{{\mvfont\char#1}}
\def\Email{\mvchr{107}}  \def\Telefon{\mvchr{84}}
\def\u{\,\rm}

\line{\bf Departamento de Fisica \hfil Universidad de Santiago de Chile}
\line{Teoría a Física I (22104)\hfil {\bf EXAMEN}\hfil 
      Ingeniería Matemática\strut}
\hrule \kern1.5pt \hrule \medskip
\line{Prof. Carlos H. Esparza-Barrera\hfil 
      \lower.5ex\hbox{\Email} [email protected]\hfil
      {\Telefon} (56-2-)7181239\hfil Oficina 27\strut}
\medskip \hrule
\bigskip

\begitems \style x \parskip=\medskipamount
* {\typosize[12/14]\bf Esta prueba consta de cuatro problemas, 
  usted debe responder tres de ellos. La elección es suya y debe
  indicarla en la hoja. Si responde los cuatro, se considerarán 
  los tres peor evaluados.\par}
* Fundamente su razonamiento; haga esquemas explicatorios. Use
  lápiz  indeleble; en caso contrario, no puede pretender una segunda
  revisión de su trabajo. Exprese sus
  repuestas numéricas con 3 CS.
* Las situaciones y los valores numéricos de los datos suministrados no   
  necesariamente corresponden a los de un experimento o situación práctica   
  real. Se pretende que usted trabaje cada problema con el modelo 
  adecuado en el marco de la teoría pertinente y obtenga las predicciones
  correspondientes.
\enditems

\hrule\bigskip

\begmulti 2

\sec Insectos


Algunos coleópteros pueden proyectarse verticalmente por sí mismos con una
aceleración de unos $400{\u g}$ (ésto es, un orden de magnitud superior de
lo que un ser humano con entrenamiento puede resistir). El impulso proviene 
en algunos casos de desdoblar sus patas y en otros de curvar violentamente 
el abdomen, hecho que origina un recorrido vertical durante la aceleración 
de unos 0,5{\u cm}. Bajo las anteriores consideraciones:

\begitems \style n
* ¿A qué altura pueden saltar?
* ¿Cuánto tiempo permanecen en el aire?
\enditems

\sec Dos bloques

Un bloque de masa $m= 30{\u kg}$ desliza con aceleración horizontal
$a_{\u m}= 3{\u m/s^2}$ por la parte superior de otro bloque de masa
$M= 30{\u kg}$ por la acción de una fuerza horizontal de magnitud   
$F= 160{\u N}$, como se indica en la Figura.

El bloque de masa $M$ está sobre una superficie horizontal sin roce. Entre
los bloques
$m$ y $M$ hay roce.
\begitems \style n 
* Determine el coeficiente de roce cinético entre los bloques.
* Determine la aceleración del bloque $M$ durante el tiempo que $m$ está
  completamente en contacto con $M$.
\enditems

\endmulti
\bye

Das Ergebnis ist:

Prüfung

Sie können versuchen, dies durch vorzuverarbeiten pdfcsplain document. Das pdfcsplainFormat wird hier empfohlen, um UTF-8-Codes wie ó, í, á richtig interpretieren zu können. Das umgekehrte Fragezeichen kann in csplaineinem \mubytePrimitiv deklariert werden (siehe dritte Zeile im Code).

verwandte Informationen