von gasty » So 28. Mär 2010, 23:50
Hey alle zusammen,
ich versuche jetzt schon seit einiger Zeit Sections als weiße Schrift auf weißem Hintergrund zu realisieren. Ich habe dabei zwei Ansätze, die ich derzeit verfolge; leider ist keiner momentan befriedigend.
Wenn ich mittels \begin{shaded} \end{shaded} eine solche Box einfüge ist sie extrem groß. Gibt es da eine Möglichkeit, die höhe manuell zu ändern? Beispielcode:
\documentclass[a4paper, 10pt]{article}
\usepackage[compact]{titlesec}
\usepackage{xcolor}
\usepackage{framed}
\titlespacing{\section}{0pt}{*6}{*2.1}
\titlespacing{\subsection}{0pt}{*6}{*1.8}
\titlespacing{\subsubsection}{0pt}{*6}{*0.8}
\titleformat{\section}{\color{white}\small}{\thesection}{1em}{}
\titleformat{\subsection}{\bfseries\small}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\bfseries\small}{\thesubsubsection}{1em}{}
\definecolor{shadecolor}{named}{black}
\begin{document}
\begin{shaded}
\section{\color{white}Section}
\end{shaded}
\subsection{Subsection}
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\end{document}
Der andere Ansatz benutzt \colorbox anstelle der shaded-Umgebung, also sowas wie
\documentclass[a4paper, 10pt]{article}
\usepackage[compact]{titlesec}
\usepackage{xcolor}
\usepackage{framed}
\titlespacing{\section}{0pt}{*6}{*2.1}
\titlespacing{\subsection}{0pt}{*6}{*1.8}
\titlespacing{\subsubsection}{0pt}{*6}{*0.8}
\titleformat{\section}{\color{white}\small}{\thesection}{1em}{}
\titleformat{\subsection}{\bfseries\small}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\bfseries\small}{\thesubsubsection}{1em}{}
\definecolor{shadecolor}{named}{black}
\begin{document}
\section{\colorbox{black}{Section\hspace{\columnwidth}}}
\subsection{Subsection}
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\end{document}
Dabei treten zwei Probleme auf. Zum einen weiß ich nicht, wie ich \hspace genau so einstellen kann, dass die restliche Zeile genau ausgefüllt wird. Zum anderen ist die Section-Nummer nicht von der Box umrandet.
Hoffe, ihr könnt mir da weiterhelfen. Ich bin leider eher ein dilettantischer Anwender von Tex und hab nicht viel Zeit, mich lange in die Thematik einzuarbeiten. Also dachte ich, ich hör mal bei Leuten nach, die eh schon Ahnung haben. Wäre wirklich für Ratschläge dankbar.
Gruß, Klaus
Hey alle zusammen,
ich versuche jetzt schon seit einiger Zeit Sections als weiße Schrift auf weißem Hintergrund zu realisieren. Ich habe dabei zwei Ansätze, die ich derzeit verfolge; leider ist keiner momentan befriedigend.
Wenn ich mittels \begin{shaded} \end{shaded} eine solche Box einfüge ist sie extrem groß. Gibt es da eine Möglichkeit, die höhe manuell zu ändern? Beispielcode:
[code]
\documentclass[a4paper, 10pt]{article}
\usepackage[compact]{titlesec}
\usepackage{xcolor}
\usepackage{framed}
\titlespacing{\section}{0pt}{*6}{*2.1}
\titlespacing{\subsection}{0pt}{*6}{*1.8}
\titlespacing{\subsubsection}{0pt}{*6}{*0.8}
\titleformat{\section}{\color{white}\small}{\thesection}{1em}{}
\titleformat{\subsection}{\bfseries\small}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\bfseries\small}{\thesubsubsection}{1em}{}
\definecolor{shadecolor}{named}{black}
\begin{document}
\begin{shaded}
\section{\color{white}Section}
\end{shaded}
\subsection{Subsection}
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\end{document}
[/code]
Der andere Ansatz benutzt \colorbox anstelle der shaded-Umgebung, also sowas wie
[code]
\documentclass[a4paper, 10pt]{article}
\usepackage[compact]{titlesec}
\usepackage{xcolor}
\usepackage{framed}
\titlespacing{\section}{0pt}{*6}{*2.1}
\titlespacing{\subsection}{0pt}{*6}{*1.8}
\titlespacing{\subsubsection}{0pt}{*6}{*0.8}
\titleformat{\section}{\color{white}\small}{\thesection}{1em}{}
\titleformat{\subsection}{\bfseries\small}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\bfseries\small}{\thesubsubsection}{1em}{}
\definecolor{shadecolor}{named}{black}
\begin{document}
\section{\colorbox{black}{Section\hspace{\columnwidth}}}
\subsection{Subsection}
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\end{document}
[/code]
Dabei treten zwei Probleme auf. Zum einen weiß ich nicht, wie ich \hspace genau so einstellen kann, dass die restliche Zeile genau ausgefüllt wird. Zum anderen ist die Section-Nummer nicht von der Box umrandet.
Hoffe, ihr könnt mir da weiterhelfen. Ich bin leider eher ein dilettantischer Anwender von Tex und hab nicht viel Zeit, mich lange in die Thematik einzuarbeiten. Also dachte ich, ich hör mal bei Leuten nach, die eh schon Ahnung haben. Wäre wirklich für Ratschläge dankbar.
Gruß, Klaus