1

I'm trying to help out the founders of a new open access journal called Seeds of Science to translate their article template from Word to LaTex.

The top of every page should look like this: enter image description here

My rough attempt for now looks like this: enter image description here

The main problem is that the text should wrap around the logo in the upper right corner. This is what I have so far:

\documentclass{article}
\usepackage[a4paper,margin=2.2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}

\definecolor{sosgreen}{RGB}{56,118,29} \renewcommand{\familydefault}{\sfdefault}

\AddToHook{shipout/background}[hook]{ \put (\paperwidth - 1 cm, -2.2cm){% relative to upper left corner \begin{tikzpicture}[baseline=(current bounding box.north)] \fill[sosgreen] (0,0) rectangle (1, 4.62); \end{tikzpicture}} \put (\paperwidth - 4.5 cm, -3.2cm){ \includegraphics[width=2.92 cm]{sos.png}} }

\renewcommand{\footrulewidth}{0.4pt} \fancyheadoffset[rh]{-27mm} \pagestyle{fancy} \fancyhf{} \rhead{\LARGE \color{sosgreen}\textit{Seeds of Science}} \lfoot{Author (Date)} \rfoot{\thepage\ of \pageref{LastPage}}

\begin{document}

\lipsum[1-4]

\end{document}

Is there some way to change the length of the first few lines on each page or something like that? Or perhaps there is some solution using wrapfig? Any help would be much appreciated!

eparra
  • 11
  • to a first approximation that is not possible in TeX, the line breaking happens before page breaking, so you can not adjust the first line after an automatic page break. It would be possible to have some complicated multi-pass scheme that corrected the line length on the next run, but could affect later page breaks and it might take several runs to converge, or not converge at all. – David Carlisle May 02 '22 at 10:29
  • Just persuade the publishers to raise that circle by a few points so the first line fits underneath. – David Carlisle May 02 '22 at 10:31
  • I'm sure someone will step in and give a good solution, I would like to provide a different perspective. Why do you want to do this? Of course the obvious answer is because they want it look like this, but honestly, I think this is a mistake. IMHO the frame of the page should not affect the text. I've looked at some articles and I'm aware that they used to do this. But a switch to LaTeX can also be a good time to get rid of old ways of doing it? Overall, the format looks nice, with justified paragraphs and the logo not interfering I think it would be even better. – pschulz May 02 '22 at 10:31
  • And while you at it convince them of switching to a free font ;) (maybe to a serif font) – pschulz May 02 '22 at 10:35
  • Ok, thank you both. – eparra May 02 '22 at 11:45
  • It could be done with \everypar by checking how much space is left on the page and applying \parshape. You would need to modify @afterheading and every other macro which modifies \everypar. – John Kormylo May 02 '22 at 12:55
  • @JohnKormylo not in one pass. \everypar is executed early and has no idea of the final position of the paragraph, or even which page the paragraph is on, eg if a float is inserted on the page \everypar's idea of the current position will not match the actual output. – David Carlisle May 02 '22 at 12:58
  • @DavidCarlisle - Recalling earlier experiments, the biggest problem is locating the end of the paragraph. See https://tex.stackexchange.com/questions/560195/patch-wrapfig-to-work-with-lines-instead-of-paragraphs/560291?r=SearchResults&s=14|7.9536#560291 An aux file solution would certainly be more reliable. – John Kormylo May 02 '22 at 13:10
  • @JohnKormylo current latex has paragraph hooks that allow you to hook in to start and end of a paragraph without touching everypar explicily, but the problem is more fundamenal, floats which may have not even have been seen yet may be inserted on this page, so there is no possibility of determining the current vertical position in \everypar you can make a rough guess that might work if there are no floats or footnotes, but to get any reliable answer requires \pdfsavepos and a multi-pass algorithm. – David Carlisle May 02 '22 at 13:17

0 Answers0