Page LayoutLatex doing newpage inexplicably (for me)

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
albuquerque
Posts: 6
Joined: Fri Sep 10, 2010 4:55 pm

Latex doing newpage inexplicably (for me)

Post by albuquerque »

Hi. This is my first post here (besides the "New Members" post) and i have a doubt to which i can't find explanation, and is driving me a little nuts.

In the middle of a paragraph, i get a new page if the paragraph gets beyond 3 lines. Why is this happen ? I've no clue at all.

Sample

\newcommand{\tab}{\hspace*{27pt}}

\section{ Section1}
\subsection{SubSection1}

{\scriptsize \bfseries \tab Title \\}
{\tab texttextexttext}
{\\ \tab }
{\scriptsize \bfseries \tab Title2 \\}
{\tab if this text gets to long (4 lines) i get a new page. But i'm in the middle of the page, at most! }

\subsection{SubSection1}

....

Thanks in advance for any help.
Last edited by albuquerque on Mon Sep 13, 2010 5:28 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Latex doing newpage inexplicably (for me)

Post by frabjous »

Please read the Board Rules and construct a proper minimal working example according to the guidelines there. It is impossible to tell from this code snippet.
albuquerque
Posts: 6
Joined: Fri Sep 10, 2010 4:55 pm

Latex doing newpage inexplicably (for me)

Post by albuquerque »

sorry, i got the wrong impression that we should try to put the less code possible, not a minimal working example.

Sorry again, i'll do it.

Thanks
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Latex doing newpage inexplicably (for me)

Post by localghost »

albuquerque wrote:sorry, i got the wrong impression that we should try to put the less code possible, not a minimal working example.[…]
How is that possible? The rules are actually very clear in that point. But there are some other things to be noticed [1].

And please explain what you are after with this horrible piece of code. This is not the way of writing documents with LaTeX.

[1] View topic: Avoidable mistakes


Thorsten
albuquerque
Posts: 6
Joined: Fri Sep 10, 2010 4:55 pm

Re: Latex doing newpage inexplicably (for me)

Post by albuquerque »

I was going to post the working (well, almost working) code, but i think it's better not to annoy you with it. If i can't get help from the start, six months from now i can write perfect code but i won't need your help any more.
i'm really sorry to have bothered you.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Latex doing newpage inexplicably (for me)

Post by localghost »

albuquerque wrote:I was going to post the working (well, almost working) code, but i think it's better not to annoy you with it. If i can't get help from the start, six months from now i can write perfect code but i won't need your help any more.
i'm really sorry to have bothered you.
In which way do I have to understand that? Simply post a small example that reproduces the undesired behaviour. From what you have provided so far nothing can be done to give specific help. And if you explain what you want to achieve, we are in a better position to help you.

I especially don't understand what you are aiming at with this \tab command. Seems to me like you want an indentation for every single paragraph. Do you want to change the margins or something similar? At the moment I have more questions than answers.
albuquerque
Posts: 6
Joined: Fri Sep 10, 2010 4:55 pm

Latex doing newpage inexplicably (for me)

Post by albuquerque »

But i'm telling you you're right! I read some latex tutorials yesterday, look at some templates, choose one, start writing my first tex text today. Maybe i should read the entire manual first and look at some real life samples before starting making questions here. I just added some sections to a template and start write. Then you call it terrible :-) I'm pretty sure it is, if you say so.

But then, here it is. Please don't call me awful things :-)
Thanks

If i remove the section4, everything works fine.

Code: Select all

\documentclass[10pt,titlepage]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{geometry} 
\geometry{a4paper} 
\usepackage{graphicx} 
\usepackage{booktabs} 
\usepackage{array} 
\usepackage{paralist} 
\usepackage{verbatim}
\usepackage{subfig} 
\usepackage{makeidx}
\usepackage{fancyhdr} 
\pagestyle{fancy} 
\renewcommand{\headrulewidth}{0.4pt} 
\lhead{Title}\chead{}\rhead{\thepage}
\lfoot{}\cfoot{}\rfoot{}
\newcommand{\tab}{\hspace*{27pt}}

\usepackage{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape} 
\usepackage[nottoc,notlof,notlot]{tocbibind} 
\usepackage[titles,subfigure]{tocloft} 
\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} 

\title{Title\\*\Huge Subtitle}
\author{A}

\begin{document}
\maketitle
\newpage
\newpage

\section{ Produção}
\subsection{Falta de controlo de algumas matérias primas e/ou subsidiárias}
{\scriptsize \bfseries \tab Descrição \\}
{\tab Não é possível identificar a quantidade e qualidade da \textbf{tinta} usada em cada FP. Invalida a sua gestão cirúrgica e permanente. Os \textbf{rolos} usados no enrolamento das etiquetas também não são objecto de inventariação permanente, bem como as \textbf{caixas} de embalar. São estas as \textbf{três} principais falhas encontradas relativas ao controlo de todos as matérias usadas na produção.}
{\scriptsize \bfseries \tab Resolução \\}
{\tab A maior dificuldade para a solução destas falhas prende-se com a questão da \textbf{tinta}. Já várias soluções foram equacionadas em ocasiões anteriores. A solução ideal seria o completo automatismo da mistura de tintas e do seu consumo, através de uma máquina externa com ligações ao sistema da FPE. As soluções de compromisso implicariam um esforço extra de cada impressor, procedendo ele próprio à pesagem das misturas e respectivas sobras.}
{\\ \tab O controle das \textbf{caixas} de embalar reveste-se de alguma simplicidade quando comparado com matérias como o \textbf{papel} ou as \textbf{tintas}. Dado que o processo de entrada em stock já está controlado e a sua codificação feita, o embalador terá apenas de registar o \textbf{código da caixa} (via scanner de código de barras ou manualmente) no momento em que efectua o registo de envio da encomenda. Com os \textbf{rolos} o processo é análogo, com a diferença que a sua entrada e codificação ainda não está efectuada e, mais importante ainda, existe uma especifidade própria que consiste no facto de dois (ou até mais) rolos poderem ser conjugados dando origem a outro.}
{\scriptsize \bfseries \tab Implementação \\}
{\tab Here the new page happens, i don't know why}

\subsection{Geolocalização do stock de etiquetas}
\subsection{Registos de controle de qualidade}
\subsection{Previsões de produção}

\section{Section2}

\subsection{Criação processos de terceiros}
\subsection{Encomendas a fornecedores}
\subsection{Registo documentos de fornecedores}
\subsection{Gestão de cobranças}
\subsection{Tratamento de reclamações}
\subsection{Automatização de orçamentos}

\section{Section3}
\subsection{Página}
\subsection{Encomendas online}

\section{Section4}
\subsection{Rever descrição interna de papéis}
\subsection{Rever descrição do "artigo" etiquetas}

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Latex doing newpage inexplicably (for me)

Post by localghost »

Well, your example is not minimal but at least something to work with. The page break occurs because of the following empty sections and subsections. Just fill them with some text and the page break will disappear. I don't see any other problem with this code apart from the fact that you should write your document in a different way.
albuquerque wrote:[…] I read some latex tutorials yesterday, look at some templates, choose one, start writing my first tex text today. Maybe i should read the entire manual first and look at some real life samples before starting making questions here. I just added some sections to a template and start write. […]
I don't know which tutorials you have read, but you should do again some basic reading [1]. And templates you got somewhere from the net should always be used with caution. Most of them are not up to date.

See below for an example based on your code. I added some important packages, also dropped some and replaced them with other ones. The comments shall guide you. Please read the manuals of the involved packages.

Code: Select all

\documentclass[10pt,a4paper,titlepage]{article}
\usepackage[T1]{fontenc}      % Enable Cork Encoding for better hyphenation
\usepackage[utf8]{inputenc}   % Direct insertion of specail charaters
\usepackage[portuges]{babel}  % Setup for language Portuges
\usepackage{geometry}         % Setup for page dimensions
\usepackage{graphicx}         % Inclusion of external graphics files
\usepackage{booktabs}         % Nice looking tables
\usepackage{array}            % Extension of »table« and »array« environments
\usepackage{paralist}         % Enable Lists in paragraph mode
\usepackage{verbatim}         % Extensions to the »verbatim« environment
\usepackage{subfig}           % Dividing figure into sub-figures
\usepackage{makeidx}          % Generation of an index
\usepackage[%
  indentfirst,                % Indent first paragraph after a heading
  pagestyles,                 % Enable declaration of new page styles
  raggedright,                % Headings appear flushed to the left without hyphenation
  sf                          % Headings appear in sans serif font
]{titlesec}                   % Setting up headings, pagestyles and other formatting options
\usepackage[%
  nottoc,                     % ToC not in Table of Contents
  notlof,                     % LoF not in Table of Contents
  notlot                      % LoT not in Table of Contents
]{tocbibind}
\usepackage[%
  subfigure,                  % Only necessary when used together with »subfigure« (or »subfig«) package
  titles                      % list titles typeset with default settings
]{tocloft}

% ToC formatting (tocloft)
\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape}

% Setup for headers and footers
\newpagestyle{main}{%
  \sethead[\thepage][][Title]{Title}{}{\thepage}
  \setfoot[][][]{}{}{}
  \headrule
}
\pagestyle{main}

\title{Title\\*\Huge Subtitle}
\author{albuquerque}
\makeindex

\begin{document}
  \maketitle
  \tableofcontents
  \newpage

  \section{Produção}
  \subsection{Falta de controlo de algumas matérias primas e/ou subsidiárias}
    \textbf{\scriptsize Descrição}

    Não é possível identificar a quantidade e qualidade da \textbf{tinta} usada em cada FP. Invalida a sua gestão cirúrgica e permanente. Os \textbf{rolos} usados no enrolamento das etiquetas também não são objecto de inventariação permanente, bem como as \textbf{caixas} de embalar. São estas as \textbf{três} principais falhas encontradas relativas ao controlo de todos as matérias usadas na produção.

    \medskip
    \textbf{\scriptsize Resolução}

    A maior dificuldade para a solução destas falhas prende-se com a questão da \textbf{tinta}. Já várias soluções foram equacionadas em ocasiões anteriores. A solução ideal seria o completo automatismo da mistura de tintas e do seu consumo, através de uma máquina externa com ligações ao sistema da FPE. As soluções de compromisso implicariam um esforço extra de cada impressor, procedendo ele próprio à pesagem das misturas e respectivas sobras.

    O controle das \textbf{caixas} de embalar reveste-se de alguma simplicidade quando comparado com matérias como o \textbf{papel} ou as \textbf{tintas}. Dado que o processo de entrada em stock já está controlado e a sua codificação feita, o embalador terá apenas de registar o \textbf{código da caixa} (via scanner de código de barras ou manualmente) no momento em que efectua o registo de envio da encomenda. Com os \textbf{rolos} o processo é análogo, com a diferença que a sua entrada e codificação ainda não está efectuada e, mais importante ainda, existe uma especifidade própria que consiste no facto de dois (ou até mais) rolos poderem ser conjugados dando origem a outro.

    \medskip
    \textbf{\scriptsize Implementação}

    Here the new page happens, i don't know why. The undesired page break won't appear if you fill the sections and sub-sections that follow with some text.
\end{document}
[1] View topic: LaTeX Resources for Beginners
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Latex doing newpage inexplicably (for me)

Post by frabjous »

Let me just say quickly that no one is trying to call you names. We were all LaTeX beginners once, and we know how steep the learning curve is. I'm sure I wrote some worse mark-up when first starting out. Don't be intimidated to ask questions here; that's what the forum is for. But do pay attention to the rules; they're here not just for our benefit, but for yours. You get better responses when they are followed, and often the process of creating a minimal example itself helps you realize what the problem is.

About the defined \tab command: I happen to know that the rtf2latex2e converter does something a lot like that. It drives me crazy, and I always have to strip them out afterwards. Did you get this code from conversion? If so, that kind of thing is nice to know.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Latex doing newpage inexplicably (for me)

Post by localghost »

frabjous wrote:[…] About the defined \tab command: I happen to know that the rtf2latex2e converter does something a lot like that. It drives me crazy, and I always have to strip them out afterwards. Did you get this code from conversion? If so, that kind of thing is nice to know.
A very interesting note. But if this converter is also responsible for all the other weird things, it should be used with caution. This would require a lot of post-processing to get proper code for the document.
Post Reply