ich bin leider immer noch ein Anfänger und beim googeln habe ich nichts gefunden.
Ich würde gerne einen Algorithmus nieder schreiben. Das ganze soll so aussehen:
1.1 Algoritmus
Step 1: mache was
Step 2: mache was
Step 3: mach was und wenn das, dann geh zu S1
Step 4: Wenn das dann Ende, sonst gehe zu S1 und besonders wenn es etwas länger ist, soll die nächste Zeile unter dem "Wenn" seinund nicht unter Step 4
Da ich mehrere Algorithmen machen will soll er die auch fortlaufend zählen.
Also es soll wie bei mathematischen Sätzen Algorithmus 4.1 und Algorithmus 4.2 usw davor stehen, daher hatte ich an ctrbox gedacht, ist das richtig ?
Ich habe hier mal ein Minimalbeispiel:
\documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[german]{babel} \usepackage{mathtools} %mathclap \usepackage{multicol} %multirows & multicolumns \usepackage{eso-pic} %%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{tikz} \usetikzlibrary{tikzmark} \usepackage{pgf} \usetikzlibrary{arrows,automata,positioning} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{arrows.meta,bending} \pgfarrowsdeclarecombine{twoto}{twoto}% {to}{to}{to}{to} \usetikzlibrary{decorations.text} %%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{bm} \usepackage{xfrac} %sfrac{}{} \usepackage{amsmath} \numberwithin{equation}{section} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} %\usepackage{gensymb} %degree symbol etc. not compatible with mathabx \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage{microtype} %\usepackage{mathabx} %nicer arrows \usepackage{wasysym} \usepackage{makeidx} \usepackage{graphicx} %for scalebox \usepackage{multirow} %fancy tricks in tables \usepackage{ragged2e} % better raggedright \usepackage{pgfplots} % diagramms \usepackage{chngcntr} \usepackage{sectsty} %section fonts %\usepackage{MnSymbol} \usepackage[normalem]{ulem} %for better undelrine with wrapping \usepackage{float} % for H in float positioning \usepackage{fancyhdr} %fancy header \pagestyle{fancy} \fancyhf{} \renewcommand{\headrulewidth}{0.5pt} \fancyhead[LO,RE]{{\small \leftmark}} \fancyfoot[C]{\thepage} \usepackage[a4paper]{geometry} %margins & layout ,showframe \usepackage{booktabs} % Horizontal rules in tables (nicer) \usepackage{array} % Text wraping in tables with alignment \setcounter{MaxMatrixCols}{20} % maximum of columns in pmatrix \usepackage{caption} % to add source under captions \PassOptionsToPackage{hyphens}{url} \usepackage{hyperref} %\hypersetup{ % colorlinks, % citecolor=black, % filecolor=black, % linkcolor=black, % urlcolor=black %} \usepackage{enumitem} %lepsi itemize \usepackage{rotating} \usepackage{multicol} \usepackage{makeidx} \makeindex % % % % % % % % % % % % % % % % % % \setcounter{secnumdepth}{4} \setcounter{tocdepth}{2} \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=7000 \hbadness=7000 \let\cleardoublepage\clearpage % % % % % % % % % % % % % % % % \newcounter{thectrbox} \newtheoremstyle{break}% name {\topsep}% Space above, empty = `usual value' {\topsep}% Space below {}% Body font {}% Indent amount (empty = no indent, \parindent = para indent) {\bfseries}% Thm head font {.}% Punctuation after thm head { }% Space after thm head: \newline = linebreak {#1.#2~#3}% Thm head spec \theoremstyle{break} \newtheorem{ctrbox}[thectrbox]{\thesection} \newtheoremstyle{nbreak}% name {\topsep}% Space above, empty = `usual value' {\topsep}% Space below {}% Body font {}% Indent amount (empty = no indent, \parindent = para indent) {\bfseries}% Thm head font {.}% Punctuation after thm head { }% Space after thm head: \newline = linebreak {#3}% Thm head spec \theoremstyle{nbreak} \newtheorem{nctrbox}[]{} % % % % % % % % % % % % % % % % \setlist[itemize]{noitemsep,align=left,leftmargin=20pt,labelwidth=*} \renewcommand{\labelitemi}{\textbullet} \renewcommand{\labelitemii}{\textbullet} \renewcommand{\labelitemiii}{\textbullet} % % % % % % % % % % % % % % % \renewcommand{\qedsymbol}{{\footnotesize $\blacksquare$}} \makeatletter \renewenvironment{proof}[1][\proofname] {\par\pushQED{\qed}\normalfont\topsep6\p@\@plus6\p@\relax\trivlist\item[\hskip\labelsep\bfseries#1\@addpunct{.}]\ignorespaces}{\popQED\endtrivlist\@endpefalse} \makeatother % % % % % % % % % % % % % % % % % \renewcommand{\Im}{\mathrm{Im} \,} % image instead of imaginary part \renewcommand{\tilde}{\widetilde} \newcommand{\Arrow}{\! \! \! \! \rotatebox{90}{\makebox[0.02\textwidth]{\raisebox{-5pt}{\includegraphics[width=0.02\textwidth]{arrow.pdf}}}} \! \!\!} % % % % % % % % % % % % % % % % % % Algebra befehle \newcommand{\fix}{\mathrm{Fix}\,} \newcommand{\sgn}{\mathrm{sgn}\,} \newcommand{\id}{\mathrm{id}} \newcommand{\Aut}{\mathrm{Aut}\,} \newcommand{\coef}{\mathrm{coef}\,} \newcommand{\Ker}{\mathrm{Ker}\,} \newcommand{\ord}{\mathrm{ord}\,} \newcommand{\Inv}{\mathrm{Inv}\,} \newcommand{\xInv}[1]{#1\text{-}\mathrm{Inv}\,} \newcommand{\nOrb}[1]{#1\text{-}\mathrm{Orb}\,} \newcommand{\Orb}{\mathrm{Orb}\,} \newcommand{\factor}[2]{\text{\raisebox{3pt}{$#1$}} \ \mathclap{\text{{\LARGE /}}} \ \text{\raisebox{-3pt}{$#2$}}} \newcommand{\ifactor}[2]{\text{\raisebox{-3pt}{$#1$}} \ \mathclap{\text{{\LARGE \normalfont{\textbackslash}}}} \ \text{\raisebox{3pt}{$#2$}}} \newcommand{\sub}[2]{\mathrm{Sub}_{#1}(#2)} \newcommand{\syl}[2]{\mathrm{Syl}_{#1}(#2)} \newcommand{\ntlneq}{\,\raisebox{1pt}{$\lhd$}\hspace{-6pt}\raisebox{-4pt}{$\neq$}\,} \renewcommand{\epsilon}{\varepsilon} % schoeneres Epsilon \renewcommand{\b}[1]{\boldsymbol{#1}} % % % % % % % % % % % % % % % % % % % % Ersatz für mnsymbol \newcommand{\cupdot}{\uplus} \newcommand{\bigcupdot}{\biguplus} \renewcommand{\div}{\mid} \newcommand{\ndiv}{\nmid} % % % % % % % % % % % % % % % % % % % % \newcommand{\pot}[1]{\mathfrak{P}\left(#1\right)} \makeatletter \newcommand*{\defeq}{\mathrel{\rlap{% \raisebox{0.3ex}{$\m@th\cdot$}}% \raisebox{-0.3ex}{$\m@th\cdot$}}% =} \newcommand*{\defiff}{\mathrel{\rlap{% \raisebox{0.3ex}{$\m@th\cdot$}}% \raisebox{-0.3ex}{$\m@th\cdot$}}% \Longleftrightarrow} \newcommand*{\bdefiff}{\Longleftrightarrow\mathrel{\rlap{% \raisebox{0.3ex}{$\m@th\cdot$}}% \raisebox{-0.3ex}{$\m@th\cdot$}}% } \makeatother % % % % % % % % % % % % % % % % % % % % % INDEX \usepackage{makeidx} \makeindex \begin{document} \begin{ctrbox}[Algorithmus] Step 1: mache was \newline Step 2: mache was \newline Step 3: mach was und wenn das, dann geh zu S1 \newline Step 4: Wenn das dann Ende, sonst gehe zu S1 und jetzt steht hier was ganz langes, was dann über 2 Zeilen geht und das soll nicht unter Step 4 stehen sondern genau unter dem Wenn \newline \end{ctrbox} \end{document}
Viele Grüße !