Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 542929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:29:52+00:00 2026-05-13T10:29:52+00:00

Is it possible to specify the \section \subsection \subsubsection etc. level relative to the

  • 0

Is it possible to specify the \section \subsection \subsubsection etc. level relative to the previous level? What I’m thinking of is something like

\thissection The top level  
   \pushsection  
   \thissection The next level down  
   \thissection One more  
      \pushsection   
      \thissection Deeper  
   \popsection  
   \thissection At the same level and follows "one more"  

etc. The idea is that I’m writing a document from the inside
out, i.e., starting at a deeper levels, and I don’t know how many layers will be on top of it. This will avoid the need to do a massive re-leveling by renaming \subsection to \subsubsection etc.

BTW, a Google search for latex and “relative section” results in hits that almost exclusively involve misuse of the word “relative”; the authors meant to say “relevant section”.

Thank you for any ideas.

Liam

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:29:52+00:00Added an answer on May 13, 2026 at 10:29 am

    You could implement your \pushsection, \popsection, and \thissection using a counter and if-then-else logic:

    \usepackage{ifthen}
    \newcounter{section-level}
    \setcounter{section-level}{0}
    \newcommand{\pushsection}{\addtocounter{section-level}{1}}
    \newcommand{\popsection}{\addtocounter{section-level}{-1}}
    \newcommand{\thissection}[1]
    {
        \ifthenelse{\equal{\value{section-level}}{0}}{\section{#1}}{}
        \ifthenelse{\equal{\value{section-level}}{1}}{\subsection{#1}}{}
        \ifthenelse{\equal{\value{section-level}}{2}}{\subsubsection{#1}}{}
    }
    

    This will work exactly as you show above, for 3 levels of section. Of course, you should probably do something to handle out-of-range nesting levels (such as crashing the TeX build and printing a warning).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to specify a relative connection string for an AzMan XML store?
Am I doing something wrong or is it not possible to specify a generic
In SPSS 11 it was possible to specify relative paths. Example: FILE HANDLE myfile='..\..\data\current.txt'
Is it possible to specify a Java classpath that includes a JAR file contained
Is it possible to specify my own default object instead of it being null?
In VS2005 and up, is it possible to specify which configuration should be selected
I'd like to add section headers to my grouped table view's sections but I'd
It's possible to specify a particular function to be called when button is clicked
I'm possibly just blind, but is there a command line to specify conditional compilation
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.