GeneralMake a reference to a portion of text

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
GommaFleX
Posts: 10
Joined: Tue Aug 16, 2011 12:19 pm

Make a reference to a portion of text

Post by GommaFleX »

Hi, i wonder if there is a command that allows to do this. I have a "long portion of text"(it's an algorithm) that i want to move frequently in the paragraph. For example:
Initially i have

Code: Select all

some text
Long portion of text
some other text
then i want to move the "long portion of text":

Code: Select all

Long portion of text
some text
some other text
That's unhandy!
I want to do something like this:

Code: Select all

some text
\include{longportionoftext}
some other text

...

\portionoftext{longportionoftext}{
Long portion of text
}
Is there a way to do something like this?
Last edited by GommaFleX on Wed Nov 16, 2011 9:20 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Make a reference to a portion of text

Post by kaiserkarl13 »

You can put it in a separate file, e.g.

Code: Select all

% main.tex or similar name
some text
\input{longtext}
some other text

% longtext.tex
Long portion of text
Another way (and what I would probably do unless it is a LOT of text) is to define a new command:

Code: Select all

\newcommand{\longtext}{%
Long portion of text
which goes on for some time
and even

has multiple paragraphs.}
...
\begin{document}
...
some text
\longtext
some other text
GommaFleX
Posts: 10
Joined: Tue Aug 16, 2011 12:19 pm

Re: Make a reference to a portion of text

Post by GommaFleX »

Good solution, thank you!
Post Reply