Text Formattingjustified text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
freeze
Posts: 2
Joined: Wed Sep 05, 2012 7:50 pm

justified text

Post by freeze »

hi people,

i am writing my bachelor theis at the moment.
i have one problem. the text is centered instead of justified. my research results tell me, that justified if default. so I have no idea where I change this. tried a a lot....nothing works....
i think, reason cound be something about the german language setting....
so please help me thanks...
created with kile and PDFLaTeX

Code: Select all

\documentclass[a4paper,12pt,twoside,ngerman,DIV=calc,BCOR=3mm]{scrbook}
\usepackage[utf8x]{inputenc}

\usepackage{graphicx}		%use graphics
\usepackage{setspace}		%use spacings
\usepackage[numbers]{natbib}	%use citationsmanagment
\usepackage{ulem}		%use underline
\usepackage{color}		%use textcolors
\usepackage{amsmath}
\usepackage[ngerman]{babel}
\begin{document}
%Deckblatt


\pagestyle{plain} \pagenumbering{roman} \center{ \includegraphics[scale=0.45]{hanfried}{\large \vspace{15pt}
 }\\
 {\Huge Analyse von alterungsspeziefischen}{\large \vspace{10pt}
 }{\Huge {} transkriptionellen Veränderungen im}{\large \vspace{10pt}
 }{\Huge {} Aminosäuremetabolismus von }{\large \vspace{10pt}
 }{\Huge {} }\textit{\Huge Caenorhabditis Elegans}{\Huge {} }\\


{\large \vspace{30pt}
 \onehalfspacing }\textsc{\large B A C H E L O R A R B E I T}{\large {}
\vspace{10pt}
 }\\
 {\large {} zur Erlangung des akademischen Grades\vspace{10pt}
 }\\
 {\large {} Bachelor of Science (B.Sc.)\vspace{10pt}
 }\\
 {\large {} im Studiengang Bioinformatik \vspace{10pt}
 }\\
 {\large {} FRIEDRICH-SCHILLER-UNIVERSITÄT JENA \vspace{3pt}
 }\\
 {\large {} Fakultät fuer Mathematik und Informatik \vspace{10pt}
 }\\
 {\large {} eingereicht von Marco Blickensdorf \vspace{10pt}
 }\\
 {\large {} geb. am 17.07.1989 in Jena, Deutschland\vspace{10pt}
 }\\
 {\large {} Betreuer: JProf. Dr. Christoph Kaleta \vspace{10pt}
 }\\
 {\large {} Jena, den 04.09.2012 } \thispagestyle{empty} \clearpage{}
\pagenumbering{arabic}}

% Seite 1



\section{\textrm{Zusammenfassung}}

\newpage{}

\tableofcontents{}

\newpage{}

\begin{onehalfspace}

\section*{\textrm{Vorwort}}
\end{onehalfspace}

\begin{doublespace}
\noindent Die vorliegende Arbeit enstand im Rahmen des Projektes JenAge

......................................
......................................
......................................


Seitens des Verfassers bestehen keine Einwände die vorliegende Bachelorarbeit
für die öffentliche Benutzung im Universitätsarchiv zur Verfügung
zu stellen.

Jena, 27.07.2012 \end{onehalfspace}

\end{document}
Last edited by Stefan Kottwitz on Wed Sep 05, 2012 8:12 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

justified text

Post by cgnieder »

Welcome to the LaTeX community!

You've used the command \center which doesn't exist (well, it does, but it is not meant to be used like this). This switches your document to a centered column, regardless of a following argument.

It is actually meant to be used as environment:

Code: Select all

\begin{center}
  centered stuff
\end{center}
Alternatively you could use \centering which again is a switch so one should keep its effect local:

Code: Select all

\begingroup
\centering
  centered stuff
\endgroup
Regards
site moderator & package author
freeze
Posts: 2
Joined: Wed Sep 05, 2012 7:50 pm

Re: justified text

Post by freeze »

yeah. thanks a lot. I just wanted the first page to be centered. didnt know i center everything in that way..
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

justified text

Post by cgnieder »

If I may: I have a few suggestions regarding your code:
  • you're using \Huge and \large much too often. They're switches so you place them once and the font size stays in effect until you reset it again by another switch like \normalfont.
  • you're inserting vspace after every line and end the line with \\. This is unnecessary. For instance you can specify the amount of vspace to be inserted after \\ with its optional argument like \\[10pt]. Or, since you seem to use this more often set the leading of the lines to a higher value (e.g. using the setspace package that you've already loaded).
  • You're only using \section instead of \chapter and then manually insert pagepreaks before them. Since you're using scrbook I would instead suggest to use \chapter or KOMA's \addchap.
  • You're resetting KOMA's sectioning font in each \section manually with \textrm. This is not the recommended way. KOMA-Script offers the command \setkomafont for this.
Below is a modified version of your code that takes care of all these points:

Code: Select all

\documentclass[a4paper,12pt,twoside,ngerman,DIV=calc,BCOR=3mm]{scrbook}
\usepackage[utf8x]{inputenc}

\usepackage{graphicx}   %use graphics
\usepackage{setspace}   %use spacings
\usepackage[numbers]{natbib}%use citationsmanagment
\usepackage{ulem}   %use underline
\usepackage{color}  %use textcolors
\usepackage{amsmath}
\usepackage[ngerman]{babel}

\usepackage{lipsum}% für Dummy-Text

\setkomafont{sectioning}{\normalfont\bfseries}
\newcommand*\latinname[1]{\textit{#1}}

\begin{document}
%Deckblatt

\pagestyle{plain}
\thispagestyle{empty}
\pagenumbering{roman}
\begingroup
\centering\onehalfspacing
% \includegraphics[scale=0.45]{hanfried}
\vspace{15pt}
\Huge
Analyse von alterungsspeziefischen transkriptionellen Veränderungen im
Aminosäuremetabolismus von \latinname{Caenorhabditis Elegans}

\vspace{30pt}\large
\textsc{B A C H E L O R A R B E I T}

\vspace{10pt}

zur Erlangung des akademischen Grades

Bachelor of Science (B.Sc.)

im Studiengang Bioinformatik

\vskip10pt
FRIEDRICH-SCHILLER-UNIVERSITÄT JENA
\vskip-8pt
Fakultät fuer Mathematik und Informatik
\vskip10pt

eingereicht von Marco Blickensdorf

geb. am 17.07.1989 in Jena, Deutschland

Betreuer: Prof. Dr. Christoph Kaleta

Jena, den \today

\endgroup
\newpage

% Seite 1

\chapter{Zusammenfassung}
\lipsum[1-3]

\tableofcontents

\addchap{Vorwort}
\lipsum

\end{document}
Regards
site moderator & package author
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

justified text

Post by Stefan Kottwitz »

Hi Marco,

welcome to the board!

I studied in Jena too. Mathematics - until the "Vordiplom", afterwards I continued in Hamburg. Before I got lost at sea, for about 10 years. :D

Clemens alredy gave very good advice. In LaTeX, one should define document wide styles, instead of using adding some space here and some space there, which may become hard to handle in a large document. Hoewever, tweaks at the very end are ok - just avoid before, otherwise you change it again and again... focus on the content, the layout can be polished at the end.

Stefan
LaTeX.org admin
Post Reply