0

I really like Gladwell's center aligned TOC below. How would I create this with LaTeX? When I google search, the TOCs I'm finding are center justified (i.e., aligned to the margins). Sorry for the lack of code but I don't know where to begin. Not sure if matters, but I'm using memoir.

EDIT:

The one addition to Gladwell's TOC I'd like to add is parts with the format Parts <number string>: <title>. E.g., "Part One: The Beginning".

enter image description here

  • 3
    There's no need for a lack of code. Essentially, you should provide the community with a foundation to work from, rather than them having to type \documentclass...\end{document} themselves. So, create a base document, with some chapters and section and possibly some lipsum text, that creates a ToC. Then the community can copy-and-paste and work. – Werner Feb 10 '23 at 00:35
  • 2
    Include in your updated post the need for the fonts that you display in the image. You just say that you "like" that ToC... but do you need both the horizontal formatting and the fonts? – Werner Feb 10 '23 at 00:36
  • 2
  • 1
    This answer here might be a good starting point. For the font, \usepackage[light, osf]{CormorantGaramond} seems to give a good approximation if you adjust the letter spacing and turn off the ligatures for "Th". – der_herr_g Feb 10 '23 at 01:55
  • 1
    Do as @Werner asked and provide a short MWE (from \documentclass... to \end{document}) that we can compile that shows your problem. Why do you expect others to invent a document that may have nothing to do with your problem? --- GOM – Peter Wilson Feb 11 '23 at 18:45
  • @PeterWilson I didn't expect anyone to invent a document. I was just looking for guidance which Werner and der_herr_g kindly provided. – buttonsrtoys Feb 13 '23 at 00:35
  • 1
    @Werner's guidance, was to create an MWE, which you ignored. – Peter Wilson Feb 14 '23 at 19:37
  • 1
    The general guidance is to use LaTeX properly to suit your needs. You have provided no help to anyone who might assist you. -GOM – Peter Wilson Feb 14 '23 at 19:50
  • @PeterWilson the helpful guidance that Werner provided that I was referring to was the link he put in his comment which I had not found in my searches. You said I provided "no help". What I provided was a clear question with a sample pic. That was enough for Werner and der_herr_g to provide me with an answer. I apologize that it was not enough for you. – buttonsrtoys Feb 15 '23 at 14:42
  • 2
    Your "clear question" was equivalent to "I baked a cake but it was inedible". – Peter Wilson Feb 15 '23 at 19:08
  • 2
    @buttonsrtoys If any body need any clarification, please explain properly, then only you can get better suggestion, Peter Wilson is one of a LaTeX great, so please give proper reply, your words really hurts (sorry if my words hurts you) – MadyYuvi Feb 16 '23 at 15:29
  • 1
    @buttonsrtoys @PeterWilson literally created the memoir class that you are using, have some respect. – JamesT Feb 16 '23 at 15:38
  • @MadyYuvi and JamesT, thanks for the messages. I appreciate the sentiment. I didn't know where to begin with writing an MWE so posted my question apologetically asking for guidance and posted an image of what I wanted. Werner and der_herr_g gave me enough guidance to send me on a path, for which I'm indebted. I found PeterWilson's post "Why do you expect others to invent a document that may have nothing to do with your problem?" aggressive and offensive, as were his follow-up comments. I will gladly apologize after he apologizes. – buttonsrtoys Feb 16 '23 at 17:56
  • 1
    @buttonsrtoys My comment was regarding your first post of 3 lines. I am sorry if you think I was offensive, but nothing like as offensive as yourself. – Peter Wilson Feb 16 '23 at 18:14
  • @PeterWilson No it wasn't. Your comment was because you misunderstood the intent of my question and thought I expected reviewers to write code for me. Werner and der_herr_g understood, helped me, and the result is a beautiful TOC which I shared with the forum for future users. Please spare me your non-apologies and your insults. – buttonsrtoys Feb 16 '23 at 18:58
  • @buttonsrtoys: There are some minor issues with your output: Non-centered part/chapter description; this seems to be resolved entirely by removing \setrmarg{0em}; your \patchcmd needs a closing "failure" argument. Also, if you feel that your code solved your question, can you post it as a separate answer below, rather than an edit to your question? – Werner Feb 16 '23 at 20:26
  • @Werner Thank you for pointing out the issues with my code. I'll make your suggested changes. Thank you too for suggesting I move my code to an answer. I'll make that change and restore my OP to include the screen shot of the Gladwell TOC I was emulating. – buttonsrtoys Feb 17 '23 at 14:30
  • Your original question was about creating a centered TOC. You ignored Werners advice and ignored our suggestion to create and post a MWE. YOU failed. – Peter Wilson Feb 17 '23 at 19:01
  • @PeterWilson now that I know latex a little bit better, I'll be sure to leave an MWE in the future. Sorry my omission ruffled some feathers. – buttonsrtoys Feb 17 '23 at 19:12
  • @buttonsrtoys Thank you for your apology which I gratefully accept. However, I think that perhaps you should be more aware of the TeX Stack Exchange philosophy. – Peter Wilson Feb 17 '23 at 19:27
  • @PeterWilson Will do. Thanks. – buttonsrtoys Feb 18 '23 at 14:03

1 Answers1

2

Thanks to samples provided by @Werner and @der_herr_g in the comments to my OP, I got close to what I'm looking for. The only thing I'm scratching my head about is how to replace the Roman numeral with text numbers? So, instead of Part III I want Part Three?

EDIT:

Ah. I just had to add \renewcommand{\thepart}{\Numberstring{part}} . I updated my code and image below.

\documentclass{memoir}
\let\ordinal\relax

% TOC title \makeatletter \renewcommand{\printtoctitle}[1]{\centering\HUGE\textit{Contents}}

% Chapter \usepackage{fmtcount} \renewcommand{\thechapter}{\Numberstring{chapter}} \renewcommand{\cftchapterleader}{} \renewcommand{\cftchapterfillnum}[1]{\hspace{10pt}\huge#1\cftparfillskip\par} \renewcommand{\cftchapterfont}{} \renewcommand\chapternumberline[1]{\hfil\Large\emph{#1}\hfil\strut\huge\par\nopagebreak\hfil}

% Part \renewcommand{\cftpartleader}{} \renewcommand{\cftpartfont}{}% \renewcommand\partnumberline[1]{\centering\huge\scshape Part #1: } \renewcommand{\cftpartformatpnum}[1]{}% \renewcommand{\thepart}{\Numberstring{part}}

\patchcmd\l@part{% {\cftpartfont {#1}}\cftpartfillnum{#2}% }{% #1\cftpartfillnum{#2}% }{\typeout{patched}% }{}

% Spacing \setlength{\cftbeforechapterskip}{0pt} \setlength{\cftbeforepartskip}{50pt}

% Document \begin{document} \tableofcontents* \chapter*[Introduction]{Introduction} \part{This is the First Part} \chapter{Where it All Began} \chapter{Some More Beginning} \part{This is the Middle Part} \chapter{Some Drawn-Out Diatribe} \part{This is the Last Part} \chapter{Starting to Wrapup} \chapter{The Insightful Conclusion} \end{document}

enter image description here

  • 1
    This is not exactly an answer to the question, so you should not post it as such. If you ask a new question, you can always add a link to this one if it provides context. – Vincent Feb 17 '23 at 15:31
  • 1
    @Vincent. Thanks. Good point. I'll edit my OP to make it more exact. – buttonsrtoys Feb 17 '23 at 15:43
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – koleygr Feb 17 '23 at 17:35
  • 1
    @koleygr Sorry, I'm not following. You're saying that my answer does not answer my question? I suppose I could have been clearer in my question. I'll rework it. – buttonsrtoys Feb 17 '23 at 18:56
  • 1
    @buttonsrtoys ... Sorry for this... I was just reviewing some flagged answers and questions and unfortunately I missunderstood that this was an answer that is not clearly a solution for the OP .. But this was my mistake... You may edit (by the way I never voted neggatively neither the answer neither the question). I was just trying to help by reviewing the site-field of questions and answers that are marked for close. Sorry again – koleygr Feb 17 '23 at 19:07