1

In the style which I'm sort of copying, dates are printed against the left margin and the entry's heading (which doesn't need to conform to LaTeX sectioning commands) is centered.

I have borrowed code from another answer but it didn't produce what I expected; the centered text is missing (I admit that manipulating this is a bit outside of my wheelhouse.) I don't think that the centering group or center environment are what I want (centering would be it if I didn't need the date to be to the left just inside the margin.

\documentclass[11pt]{article} \usepackage{showframe} \usepackage{makecell} \newlength{\LeftItem} \newlength{\CenterItem} \newcommand{\entry}[2]{% \par \settowidth{\LeftItem}{ #1}% \settowidth{\CenterItem}{\Large #2}% \noindent \makebox[0pt][l]{\ #1}\hfill \makebox[0pt]{% \ifdim\LeftItem>.5\dimexpr\linewidth-\CenterItem\relax \makecell[t]{\strut \\ #2}% \else \par }% } \begin{document} \entry{25.}{S. Gulielmi Abbatis.} \end{document} 

Example of classic book

2 Answers 2

2

enter image description here

as long as your centred text will never be long enough to over-print the number you can simply do

\documentclass[11pt]{article} \usepackage{showframe} \newcommand{\entry}[2]{% \par \noindent \makebox[0pt][l]{#1}% \makebox[\textwidth]{\Large #2}} \begin{document} \entry{25.}{S. Gulielmi Abbatis.} \end{document} 

You were losing the text, and getting a warning about \ifdim not finished as you should have something like #2\fi where you had \par

1
  • Thank you, this should work (both do, but for now I prefer this output). Commented Jun 15, 2024 at 22:17
1

Why not simply use \hfill{}?

\documentclass[10pt,a4paper]{article} \NewDocumentCommand\entry{mm}{ #1\hfill{}#2\hfill{}} \begin{document} \entry{25.}{S. Gulielmi Abbatis.} \end{document} 
1
  • that does not centre #2 in the page. Commented Jun 15, 2024 at 22:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.