Child document created by lyx is this.
%% LyX 2.3.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
Hello
\end{document}
The parent document has this child document.
%% LyX 2.3.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{setspace}
\usepackage{babel}
\begin{document}
\begin{onehalfspace}
\input{Hello.tex}.
\end{onehalfspace}
\end{document}
Then, if I convert using pdflatex, I don't get "Hello." I get a redundant blank so I get "Hello ."
How can I fix this?
.in the child document – DG' Nov 01 '20 at 20:31Hello.texcontains code, that is only allowed in the preamble. But more importantly: The file contains not only the text, but also an end-of-line character, that means that everything after the input statement starts effectively on a new line. – DG' Nov 01 '20 at 21:06\minput, but I don't know, if Lxy will like it. – DG' Nov 01 '20 at 22:37\input{}add only what it is in the .tex file, but in LaTeX the end of lines are spaces. Build a tex file withecho"x" > test.texand then test what happen with\input{test.tex}.(Note: the extension is not mandatory): The result isx .(with a space). Now make the file withecho"x%" > test.texand check again. Now the end of line is part of the comment, so is not included as a space. – Fran Nov 01 '20 at 22:38echo"x" > test.texis a basic method from the system prompt to make a plain text file that only have the character "x" , but you can use also any plain text editor for that. YourHello.texfile must have only the word "Hello", not all the code that you posted exporting from lyx directly. Then will always work. Lyx can input lyx files (that are converted in the background to non-stand-alone .tex files) or non-stand-alone .tex files directly, and they will work if there are no wrong code inside, but nest a stand-alone .tex files is completely wrong. – Fran Nov 02 '20 at 08:39