LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-28-2022, 06:44 PM   #1
Faki
Member
 
Registered: Oct 2021
Posts: 574

Rep: Reputation: Disabled
setlength on various latex parameters


Have been changing the length of "\medskipamount" using "\newcommand"

Thus I have

Code:
\newcommand{\mdvl}[1]{\setlength\medskipamount{#1}}
Then for three paragraphs I do

Code:
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a
contradiction.

\mdvl{2cm}
\medskip
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.

\mdvl{3cm}
\medskip
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.
Which produces a "2cm" vertical skip between "Paragraph 1" and "Paragraph 2", and a "3cm" vertical skip between "Paragraph 2" and "Paragraph 3". All this displays as expected.

Changing to

Code:
\newcommand{\mdvll}[1]{\setlength{\medskipamount}{#1}}
gives same results as using "\mdvl".


Then this gives a fail

Code:
\newcommand{\galex-mdvlll}[1]{\setlength{\medskipamount{#1}}}
Code:
! Missing number, treated as zero.
<to be read again> 
{
l.313 \medskip
So the last command is certainly wrong.

Thus, one can either use

Code:
\setlength\medskipamount{#1}
or

Code:
\setlength{\medskipamount}{#1}
Have gone through the "latex2e" code, and have seen the use of both ways. Is one preferred over the other? Which do people consider best for readability?

Most times I have seen

Code:
\setlength\medskipamount{#1}

Last edited by Faki; 09-28-2022 at 07:36 PM. Reason: Clarification with results and analysis
 
Old 09-28-2022, 06:49 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,885
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Quote:
Originally Posted by Faki View Post
Have seen changes to "\medskipamount" like this

Code:
\newcommand{\lex-mdv}[1]{\setlength{\medskipamount{#1}}}
But also noticed things like this

Code:
\newcommand{\lex-flmv}{\setlength{\parindent}{0pt}}
Is there a preferred way?
Can you please describe what these differences in syntax do to your test data?
Quote:
Originally Posted by Faki View Post
Have also been considering

Code:
\newcommand{\lex-mdv}[1]{\setlength{\medskipamount}{#1}}}
and

Code:
\newcommand{\lex-mdv}[1]{\setlength\medskipamount{#1}}
I have the same follow-up question, which is what do these different syntax do to your input data and what specific questions do you have about those differences?

Apologies, but it is difficult to formulate an answer when there's no input and output example data.
 
Old 09-28-2022, 10:28 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,885
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Quote:
Originally Posted by Faki View Post
Have been changing the length of "\medskipamount" using "\newcommand"

Thus I have

Code:
\newcommand{\mdvl}[1]{\setlength\medskipamount{#1}}
Then for three paragraphs I do

Code:
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a
contradiction.

\mdvl{2cm}
\medskip
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.

\mdvl{3cm}
\medskip
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.
Which produces a "2cm" vertical skip between "Paragraph 1" and "Paragraph 2", and a "3cm" vertical skip between "Paragraph 2" and "Paragraph 3". All this displays as expected.

Changing to

Code:
\newcommand{\mdvll}[1]{\setlength{\medskipamount}{#1}}
gives same results as using "\mdvl".


Then this gives a fail

Code:
\newcommand{\galex-mdvlll}[1]{\setlength{\medskipamount{#1}}}
Code:
! Missing number, treated as zero.
<to be read again> 
{
l.313 \medskip
So the last command is certainly wrong.

Thus, one can either use

Code:
\setlength\medskipamount{#1}
or

Code:
\setlength{\medskipamount}{#1}
Have gone through the "latex2e" code, and have seen the use of both ways. Is one preferred over the other? Which do people consider best for readability?

Most times I have seen

Code:
\setlength\medskipamount{#1}
The two legal syntax forms are equivalent except one term amplifies precedence where it doesn't affect the output. That is simply coding style and not a right or wrong question. Naming the matrix differently is nothing critical.
 
Old 09-29-2022, 08:14 AM   #4
Faki
Member
 
Registered: Oct 2021
Posts: 574

Original Poster
Rep: Reputation: Disabled
Why does enclosing a command in "{ }" errenous?

Code:
{\medskipamount{#1}}
 
Old 09-29-2022, 10:24 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,885
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Quote:
Originally Posted by Faki View Post
Why does enclosing a command in "{ }" errenous?

Code:
{\medskipamount{#1}}
When adding brackets incorrectly regarding syntax rules, it results in a parse error.

For certain languages there are parse checkers which sometimes are more helpful than a default tool, however I have no idea here if ther are any tools beyond the default ones. Barring that you'd have to read the term specific syntax.

Or use trial and error. But when using trial and error it is unfair to question why exactly something didn't work.
 
  


Reply

Tags
latex, set



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] trouble configuring /.vimrc : vim-latex-suite addon with texmaker as latex package textillis Linux - Software 7 05-09-2013 11:38 AM
LaTeX forum / Where to ask LaTeX questions? max_sipos Linux - Software 2 12-21-2011 12:01 PM
Program accepting Latex source as input and outputs Latex file. stf92 Slackware 5 12-10-2009 01:56 AM
About LaTeX and fonts in LaTeX g4j31a5 Linux - Software 4 09-19-2006 07:36 AM
LaTeX commands: texi2pdf, latex, dvipdf kaon Linux - Software 7 01-23-2005 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration