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 542587
In Process

The Archive Base Latest Questions

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

I have the following Latex environment: \newcounter{txtctr}[section] \setcounter{txtctr}{0} \newenvironment{textex}{% This is the begin code

  • 0

I have the following Latex environment:

\newcounter{txtctr}[section] \setcounter{txtctr}{0}
\newenvironment{textex}{% This is the begin code
  \refstepcounter{txtctr} \vspace{0.2cm} {\noindent
    (T.\arabic{chapter}.\arabic{section}.\arabic{txtctr}):
  }\footnotesize\vspace{-0.2cm}}{\normalsize}

but I would like to have the counter to the right and in the middle of the text within the environment. Something like:

Canis per flumen carnem dum ferret natans 
aliamque praedam ab alio                      (T1.1.1)
Canis per flumen carnem dum ferret natans

I suppose this may have to be done with a minipage? By the way, the environment must be friendly to the verbatim environment.

Could some Latex wizard please help me?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 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:27:45+00:00Added an answer on May 13, 2026 at 10:27 am

    I’ve got a suspicion that there’s a package to do this automatically (i.e., numbered code examples), but nothing comes to mind right now.

    Which verbatim package(s) you’re using dictates exactly how you want to do this, but the general technique for vertically centring boxes like this is to use minipage as you suggest. Just set their widths appropriately and there’s not much more to it.

    \begin{minipage}[c]{0.9\linewidth}
       % your environment goes here
    \end{minipage}\hfill
    \begin{minipage}[c]{0.09\linewidth}
    (T.\arabic{chapter}.\arabic{section}.\arabic{txtctr})%
    \end{minipage}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following Code Block Which I tried to optimize in the Optimized section
I have the following expression in a latex file \begin{dfn} \tag{Diagram $$ over a
I have the following code in an attempt to align things in latex using
I have the following piece of latex code: \def\a{1} \def\b{2} \def\c{\a+\b} \def\d{\c/2} I expected
I'm trying to text-wrap floating images in LaTeX, using code like the following: \begin{wrapfigure}{R}{0.5\textwidth}
I have the following function that deletes the LaTeX command surrounding the current cursor
I have the following problem with Tikz/Latex: I have some nodes that contain text.
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have the following LaTeX file. Notice how the item on the description is
I have the following Hello World code to try out TeX rendering with matplotlib

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.