oduwsdl / wsdlthesis

ODU WS-DL Thesis/Dissertation LaTeX Template
MIT License
3 stars 11 forks source link

Subsequent chapter headings not displayed if last line of previous chapter is a comment #21

Open machawk1 opened 6 years ago

machawk1 commented 6 years ago

I encountered this bug when finishing one chapter with a comment and noticing the main chapter heading as well as the TOC listing not showing up.

The content of the following chapter is merged with the previous chapter.

For example, from the repo I modified Chapter 2:

\chapter{Background}
\label{ch:background}

\todo[The big question is whether Memento framework~\cite{memento:rfc,memento:tr} can be utilized to count historically preserved frogs?
Is Hypertext Transfer Protocol (HTTP)~\cite{http:rfc} adequate to fetch hibernated frogs?]

% I am a comment.

Nothing else in the template has changed. The result is Chapter 3's content (starting with Mat counted JCDL) appended onto the end of Chapter 2 (ends with hibernated frogs?).

screen shot 2018-02-25 at 11 59 17 pm
ibnesayeed commented 6 years ago

We are using \input command to include chapters that includes file content as it is. If the last line of a chapter is a comment and it does not have a trailing newline then the chapter heading of the next chapter is appended to that comment.

I will not call it a bug. This is possibly happening because your editor is not ensuring that a newline character is added at the end of the file. many text editors such as Atom or Nano add a newline character at the end of the file, which is generally a good thing. GitHub highlights missing newline character in files in the web interface as an error.

machawk1 commented 6 years ago

Hmm, I disagree. If we chose \input as the method of including files, we ought to account for its behavior in appending files. It is most definitely a bug, and a bug in oduwsdl/wsdlthesis and not the input command or anywhere else.

editor is not ensuring that a newline character is added at the end of the file

By design. I have my editor setup to not automatically manipulate my files. I am using TeXShop, an editor designed with LaTeX in-mind and not a general-purpose text editor. I believe that LaTeX does not mandate that files end in a newline.

ibnesayeed commented 6 years ago

While we can add some tricks to add newline character at the end of each file when concatenating them in \inputAllFiles (custommacros.sty):

  \app@exe{ls #1/*.tex | xargs cat >> #1/\jobname.tmp}%

I think it is better to leave it as it is to avoid any other consequences as it is doing what \input is expected to do.

By design. I have my editor setup to not automatically manipulate my files. I am using TeXShop, an editor designed with LaTeX in-mind and not a general-purpose text editor. I believe that LaTeX does not mandate that files end in a newline.

If you do not allow your editor to insert newline at the end of a file then you can manually add that. laTeX may not mandate any specific file endings, but the POSIX standard defines a line as something that ends with a newline character.

LaTeX provides two main methods to include files, \input and \include, of which the latter is more versatile and does include newlines (along with many other things it does). However, this thesis class has some issues that cause undesired effects in the ToC when \include is used.